mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
Rename buffer status to make it more symetrical
Only try to pull once in a timeout. We can reuse the last returned state as our internal state in audiomixer.
This commit is contained in:
parent
430b749d53
commit
cc8a5da9c7
11 changed files with 58 additions and 65 deletions
|
|
@ -1207,7 +1207,7 @@ pinos_stream_send_buffer (PinosStream *stream,
|
||||||
bid->used = true;
|
bid->used = true;
|
||||||
spa_list_remove (&bid->link);
|
spa_list_remove (&bid->link);
|
||||||
impl->trans->outputs[0].buffer_id = id;
|
impl->trans->outputs[0].buffer_id = id;
|
||||||
impl->trans->outputs[0].status = SPA_RESULT_HAVE_OUTPUT;
|
impl->trans->outputs[0].status = SPA_RESULT_HAVE_BUFFER;
|
||||||
pinos_log_trace ("stream %p: send buffer %d", stream, id);
|
pinos_log_trace ("stream %p: send buffer %d", stream, id);
|
||||||
if (!impl->in_need_buffer)
|
if (!impl->in_need_buffer)
|
||||||
send_have_output (stream);
|
send_have_output (stream);
|
||||||
|
|
|
||||||
|
|
@ -855,7 +855,7 @@ spa_proxy_node_process_output (SpaNode *node)
|
||||||
|
|
||||||
pinos_log_trace ("%d %d %d %d", io->status, io->buffer_id, tmp.status, tmp.buffer_id);
|
pinos_log_trace ("%d %d %d %d", io->status, io->buffer_id, tmp.status, tmp.buffer_id);
|
||||||
|
|
||||||
if (io->status == SPA_RESULT_NEED_INPUT)
|
if (io->status == SPA_RESULT_NEED_BUFFER)
|
||||||
send_need = true;
|
send_need = true;
|
||||||
|
|
||||||
*io = tmp;
|
*io = tmp;
|
||||||
|
|
@ -865,7 +865,7 @@ spa_proxy_node_process_output (SpaNode *node)
|
||||||
else if (flush)
|
else if (flush)
|
||||||
do_flush (this);
|
do_flush (this);
|
||||||
|
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ do_pull (PinosNode *this)
|
||||||
pinos_log_trace ("node %p: need input port %d, %d %d", this,
|
pinos_log_trace ("node %p: need input port %d, %d %d", this,
|
||||||
inport->port_id, pi->buffer_id, pi->status);
|
inport->port_id, pi->buffer_id, pi->status);
|
||||||
|
|
||||||
if (pi->status != SPA_RESULT_NEED_INPUT)
|
if (pi->status != SPA_RESULT_NEED_BUFFER)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
spa_list_for_each (link, &inport->rt.links, rt.input_link) {
|
spa_list_for_each (link, &inport->rt.links, rt.input_link) {
|
||||||
|
|
@ -291,15 +291,15 @@ do_pull (PinosNode *this)
|
||||||
|
|
||||||
res = spa_node_process_output (outport->node->node);
|
res = spa_node_process_output (outport->node->node);
|
||||||
|
|
||||||
if (res == SPA_RESULT_NEED_INPUT) {
|
if (res == SPA_RESULT_NEED_BUFFER) {
|
||||||
res = do_pull (outport->node);
|
res = do_pull (outport->node);
|
||||||
pinos_log_trace ("node %p: pull return %d", outport->node, res);
|
pinos_log_trace ("node %p: pull return %d", outport->node, res);
|
||||||
}
|
}
|
||||||
else if (res < 0 && res != SPA_RESULT_HAVE_OUTPUT) {
|
else if (res < 0 && res != SPA_RESULT_HAVE_BUFFER) {
|
||||||
pinos_log_warn ("node %p: got process output %d", outport->node, res);
|
pinos_log_warn ("node %p: got process output %d", outport->node, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == SPA_RESULT_HAVE_OUTPUT) {
|
if (res == SPA_RESULT_HAVE_BUFFER) {
|
||||||
*pi = *po;
|
*pi = *po;
|
||||||
pinos_log_trace ("node %p: have output %d %d", this, pi->status, pi->buffer_id);
|
pinos_log_trace ("node %p: have output %d %d", this, pi->status, pi->buffer_id);
|
||||||
have_output = true;
|
have_output = true;
|
||||||
|
|
@ -360,7 +360,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = spa_node_process_output (this->node);
|
res = spa_node_process_output (this->node);
|
||||||
if (res < 0 && res != SPA_RESULT_HAVE_OUTPUT)
|
if (res < 0 && res != SPA_RESULT_HAVE_BUFFER)
|
||||||
pinos_log_warn ("node %p: got process output %d", this, res);
|
pinos_log_warn ("node %p: got process output %d", this, res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ typedef enum {
|
||||||
SPA_RESULT_NO_FORMAT = -4,
|
SPA_RESULT_NO_FORMAT = -4,
|
||||||
SPA_RESULT_INVALID_COMMAND = -5,
|
SPA_RESULT_INVALID_COMMAND = -5,
|
||||||
SPA_RESULT_INVALID_PORT = -6,
|
SPA_RESULT_INVALID_PORT = -6,
|
||||||
SPA_RESULT_HAVE_OUTPUT = -7,
|
SPA_RESULT_HAVE_BUFFER = -7,
|
||||||
SPA_RESULT_NEED_INPUT = -8,
|
SPA_RESULT_NEED_BUFFER = -8,
|
||||||
SPA_RESULT_PORTS_CHANGED = -9,
|
SPA_RESULT_PORTS_CHANGED = -9,
|
||||||
SPA_RESULT_FORMAT_CHANGED = -10,
|
SPA_RESULT_FORMAT_CHANGED = -10,
|
||||||
SPA_RESULT_PROPERTIES_CHANGED = -11,
|
SPA_RESULT_PROPERTIES_CHANGED = -11,
|
||||||
|
|
|
||||||
|
|
@ -329,15 +329,16 @@ static inline snd_pcm_uframes_t
|
||||||
pull_frames (SpaALSAState *state,
|
pull_frames (SpaALSAState *state,
|
||||||
const snd_pcm_channel_area_t *my_areas,
|
const snd_pcm_channel_area_t *my_areas,
|
||||||
snd_pcm_uframes_t offset,
|
snd_pcm_uframes_t offset,
|
||||||
snd_pcm_uframes_t frames)
|
snd_pcm_uframes_t frames,
|
||||||
|
bool do_pull)
|
||||||
{
|
{
|
||||||
snd_pcm_uframes_t total_frames = 0, to_write = frames;
|
snd_pcm_uframes_t total_frames = 0, to_write = frames;
|
||||||
SpaPortIO *io = state->io;
|
SpaPortIO *io = state->io;
|
||||||
|
|
||||||
if (spa_list_is_empty (&state->ready)) {
|
if (spa_list_is_empty (&state->ready) && do_pull) {
|
||||||
SpaEvent event = SPA_EVENT_INIT (state->type.event_node.NeedInput);
|
SpaEvent event = SPA_EVENT_INIT (state->type.event_node.NeedInput);
|
||||||
|
|
||||||
io->status = SPA_RESULT_NEED_INPUT;
|
io->status = SPA_RESULT_NEED_BUFFER;
|
||||||
io->range.offset = state->sample_count * state->frame_size;
|
io->range.offset = state->sample_count * state->frame_size;
|
||||||
io->range.min_size = state->threshold * state->frame_size;
|
io->range.min_size = state->threshold * state->frame_size;
|
||||||
io->range.max_size = frames * state->frame_size;
|
io->range.max_size = frames * state->frame_size;
|
||||||
|
|
@ -401,9 +402,9 @@ pull_frames (SpaALSAState *state,
|
||||||
total_frames += n_frames;
|
total_frames += n_frames;
|
||||||
to_write -= n_frames;
|
to_write -= n_frames;
|
||||||
}
|
}
|
||||||
if (total_frames == 0) {
|
if (total_frames == 0 && do_pull) {
|
||||||
total_frames = SPA_MIN (frames, state->threshold);
|
total_frames = SPA_MIN (frames, state->threshold);
|
||||||
spa_log_warn (state->log, "underrun, want %zd frames", total_frames);
|
spa_log_trace (state->log, "underrun, want %zd frames", total_frames);
|
||||||
snd_pcm_areas_silence (my_areas, offset, state->channels, total_frames, state->format);
|
snd_pcm_areas_silence (my_areas, offset, state->channels, total_frames, state->format);
|
||||||
}
|
}
|
||||||
return total_frames;
|
return total_frames;
|
||||||
|
|
@ -419,7 +420,7 @@ push_frames (SpaALSAState *state,
|
||||||
SpaPortIO *io = state->io;
|
SpaPortIO *io = state->io;
|
||||||
|
|
||||||
if (spa_list_is_empty (&state->free)) {
|
if (spa_list_is_empty (&state->free)) {
|
||||||
spa_log_warn (state->log, "no more buffers");
|
spa_log_trace (state->log, "no more buffers");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint8_t *src;
|
uint8_t *src;
|
||||||
|
|
@ -529,6 +530,9 @@ alsa_on_playback_timeout_event (SpaSource *source)
|
||||||
state->last_ticks = state->sample_count - filled;
|
state->last_ticks = state->sample_count - filled;
|
||||||
state->last_monotonic = (int64_t)htstamp.tv_sec * SPA_NSEC_PER_SEC + (int64_t)htstamp.tv_nsec;
|
state->last_monotonic = (int64_t)htstamp.tv_sec * SPA_NSEC_PER_SEC + (int64_t)htstamp.tv_nsec;
|
||||||
|
|
||||||
|
spa_log_trace (state->log, "timeout %ld %d %ld %ld %ld", filled, state->threshold,
|
||||||
|
state->sample_count, htstamp.tv_sec, htstamp.tv_nsec);
|
||||||
|
|
||||||
if (filled > state->threshold) {
|
if (filled > state->threshold) {
|
||||||
if (snd_pcm_state (hndl) == SND_PCM_STATE_SUSPENDED) {
|
if (snd_pcm_state (hndl) == SND_PCM_STATE_SUSPENDED) {
|
||||||
spa_log_error (state->log, "suspended: try resume");
|
spa_log_error (state->log, "suspended: try resume");
|
||||||
|
|
@ -538,6 +542,7 @@ alsa_on_playback_timeout_event (SpaSource *source)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snd_pcm_uframes_t to_write = state->buffer_frames - filled;
|
snd_pcm_uframes_t to_write = state->buffer_frames - filled;
|
||||||
|
bool do_pull = true;
|
||||||
|
|
||||||
while (total_written < to_write) {
|
while (total_written < to_write) {
|
||||||
snd_pcm_uframes_t written, frames, offset;
|
snd_pcm_uframes_t written, frames, offset;
|
||||||
|
|
@ -547,9 +552,7 @@ alsa_on_playback_timeout_event (SpaSource *source)
|
||||||
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s", snd_strerror(res));
|
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s", snd_strerror(res));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
written = pull_frames (state, my_areas, offset, frames, do_pull);
|
||||||
written = pull_frames (state, my_areas, offset, frames);
|
|
||||||
|
|
||||||
if (written < frames)
|
if (written < frames)
|
||||||
to_write = 0;
|
to_write = 0;
|
||||||
|
|
||||||
|
|
@ -559,6 +562,7 @@ alsa_on_playback_timeout_event (SpaSource *source)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
total_written += written;
|
total_written += written;
|
||||||
|
do_pull = false;
|
||||||
}
|
}
|
||||||
state->sample_count += total_written;
|
state->sample_count += total_written;
|
||||||
}
|
}
|
||||||
|
|
@ -573,10 +577,6 @@ alsa_on_playback_timeout_event (SpaSource *source)
|
||||||
|
|
||||||
calc_timeout (total_written + filled, state->threshold, state->rate, &htstamp, &ts.it_value);
|
calc_timeout (total_written + filled, state->threshold, state->rate, &htstamp, &ts.it_value);
|
||||||
|
|
||||||
spa_log_trace (state->log, "timeout %ld %ld %ld %ld %ld", total_written, filled,
|
|
||||||
ts.it_value.tv_sec, ts.it_value.tv_nsec,
|
|
||||||
ts.it_value.tv_nsec - htstamp.tv_nsec);
|
|
||||||
|
|
||||||
ts.it_interval.tv_sec = 0;
|
ts.it_interval.tv_sec = 0;
|
||||||
ts.it_interval.tv_nsec = 0;
|
ts.it_interval.tv_nsec = 0;
|
||||||
timerfd_settime (state->timerfd, TFD_TIMER_ABSTIME, &ts, NULL);
|
timerfd_settime (state->timerfd, TFD_TIMER_ABSTIME, &ts, NULL);
|
||||||
|
|
|
||||||
|
|
@ -101,10 +101,7 @@ struct _SpaAudioMixer {
|
||||||
uint8_t format_buffer[4096];
|
uint8_t format_buffer[4096];
|
||||||
|
|
||||||
bool started;
|
bool started;
|
||||||
#define STATE_ERROR 0
|
SpaResult state;
|
||||||
#define STATE_IN 1
|
|
||||||
#define STATE_OUT 2
|
|
||||||
int state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CHECK_PORT_NUM(this,d,p) (((d) == SPA_DIRECTION_INPUT && (p) < MAX_PORTS) || \
|
#define CHECK_PORT_NUM(this,d,p) (((d) == SPA_DIRECTION_INPUT && (p) < MAX_PORTS) || \
|
||||||
|
|
@ -666,16 +663,14 @@ mix_output (SpaAudioMixer *this, size_t n_bytes)
|
||||||
add_port_data (this, outbuf, port, layer++);
|
add_port_data (this, outbuf, port, layer++);
|
||||||
}
|
}
|
||||||
output->buffer_id = outbuf->outbuf->id;
|
output->buffer_id = outbuf->outbuf->id;
|
||||||
output->status = SPA_RESULT_HAVE_OUTPUT;
|
output->status = SPA_RESULT_HAVE_BUFFER;
|
||||||
this->state = STATE_OUT;
|
|
||||||
|
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_audiomixer_node_process_input (SpaNode *node)
|
spa_audiomixer_node_process_input (SpaNode *node)
|
||||||
{
|
{
|
||||||
SpaResult res;
|
|
||||||
SpaAudioMixer *this;
|
SpaAudioMixer *this;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
SpaAudioMixerPort *outport;
|
SpaAudioMixerPort *outport;
|
||||||
|
|
@ -690,8 +685,8 @@ spa_audiomixer_node_process_input (SpaNode *node)
|
||||||
output = outport->io;
|
output = outport->io;
|
||||||
spa_return_val_if_fail (output != NULL, SPA_RESULT_ERROR);
|
spa_return_val_if_fail (output != NULL, SPA_RESULT_ERROR);
|
||||||
|
|
||||||
if (this->state == STATE_OUT)
|
if (this->state == SPA_RESULT_HAVE_BUFFER)
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PORTS; i++) {
|
for (i = 0; i < MAX_PORTS; i++) {
|
||||||
SpaAudioMixerPort *port = &this->in_ports[i];
|
SpaAudioMixerPort *port = &this->in_ports[i];
|
||||||
|
|
@ -701,7 +696,7 @@ spa_audiomixer_node_process_input (SpaNode *node)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (port->queued_bytes == 0 &&
|
if (port->queued_bytes == 0 &&
|
||||||
input->status == SPA_RESULT_HAVE_OUTPUT &&
|
input->status == SPA_RESULT_HAVE_BUFFER &&
|
||||||
input->buffer_id != SPA_ID_INVALID) {
|
input->buffer_id != SPA_ID_INVALID) {
|
||||||
MixerBuffer *b = &port->buffers[input->buffer_id];
|
MixerBuffer *b = &port->buffers[input->buffer_id];
|
||||||
|
|
||||||
|
|
@ -724,17 +719,16 @@ spa_audiomixer_node_process_input (SpaNode *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_queued != SIZE_MAX && min_queued > 0) {
|
if (min_queued != SIZE_MAX && min_queued > 0) {
|
||||||
res = mix_output (this, min_queued);
|
this->state = mix_output (this, min_queued);
|
||||||
} else {
|
} else {
|
||||||
res = SPA_RESULT_NEED_INPUT;
|
this->state = SPA_RESULT_NEED_BUFFER;
|
||||||
}
|
}
|
||||||
return res;
|
return this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_audiomixer_node_process_output (SpaNode *node)
|
spa_audiomixer_node_process_output (SpaNode *node)
|
||||||
{
|
{
|
||||||
SpaResult res;
|
|
||||||
SpaAudioMixer *this;
|
SpaAudioMixer *this;
|
||||||
SpaAudioMixerPort *port;
|
SpaAudioMixerPort *port;
|
||||||
SpaPortIO *output;
|
SpaPortIO *output;
|
||||||
|
|
@ -753,9 +747,8 @@ spa_audiomixer_node_process_output (SpaNode *node)
|
||||||
recycle_buffer (this, output->buffer_id);
|
recycle_buffer (this, output->buffer_id);
|
||||||
output->buffer_id = SPA_ID_INVALID;
|
output->buffer_id = SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
res = SPA_RESULT_NEED_INPUT;
|
|
||||||
/* produce more output if possible */
|
/* produce more output if possible */
|
||||||
if (this->state == STATE_OUT) {
|
if (this->state == SPA_RESULT_HAVE_BUFFER) {
|
||||||
size_t min_queued = SIZE_MAX;
|
size_t min_queued = SIZE_MAX;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PORTS; i++) {
|
for (i = 0; i < MAX_PORTS; i++) {
|
||||||
|
|
@ -768,13 +761,13 @@ spa_audiomixer_node_process_output (SpaNode *node)
|
||||||
min_queued = port->queued_bytes;
|
min_queued = port->queued_bytes;
|
||||||
}
|
}
|
||||||
if (min_queued != SIZE_MAX && min_queued > 0) {
|
if (min_queued != SIZE_MAX && min_queued > 0) {
|
||||||
res = mix_output (this, min_queued);
|
this->state = mix_output (this, min_queued);
|
||||||
} else {
|
} else {
|
||||||
this->state = STATE_IN;
|
this->state = SPA_RESULT_NEED_BUFFER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* take requested output range and apply to input */
|
/* take requested output range and apply to input */
|
||||||
if (this->state == STATE_IN) {
|
if (this->state == SPA_RESULT_NEED_BUFFER) {
|
||||||
for (i = 0; i < MAX_PORTS; i++) {
|
for (i = 0; i < MAX_PORTS; i++) {
|
||||||
SpaAudioMixerPort *port = &this->in_ports[i];
|
SpaAudioMixerPort *port = &this->in_ports[i];
|
||||||
SpaPortIO *input;
|
SpaPortIO *input;
|
||||||
|
|
@ -784,7 +777,7 @@ spa_audiomixer_node_process_output (SpaNode *node)
|
||||||
|
|
||||||
if (port->queued_bytes == 0) {
|
if (port->queued_bytes == 0) {
|
||||||
input->range = output->range;
|
input->range = output->range;
|
||||||
input->status = SPA_RESULT_NEED_INPUT;
|
input->status = SPA_RESULT_NEED_BUFFER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
input->status = SPA_RESULT_OK;
|
input->status = SPA_RESULT_OK;
|
||||||
|
|
@ -793,7 +786,7 @@ spa_audiomixer_node_process_output (SpaNode *node)
|
||||||
i, output->range.min_size, port->queued_bytes, input->status);
|
i, output->range.min_size, port->queued_bytes, input->status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SpaNode audiomixer_node = {
|
static const SpaNode audiomixer_node = {
|
||||||
|
|
@ -879,7 +872,7 @@ spa_audiomixer_init (const SpaHandleFactory *factory,
|
||||||
init_type (&this->type, this->map);
|
init_type (&this->type, this->map);
|
||||||
|
|
||||||
this->node = audiomixer_node;
|
this->node = audiomixer_node;
|
||||||
this->state = STATE_IN;
|
this->state = SPA_RESULT_NEED_BUFFER;
|
||||||
|
|
||||||
this->out_ports[0].io = NULL;
|
this->out_ports[0].io = NULL;
|
||||||
this->out_ports[0].info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
this->out_ports[0].info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||||
|
|
|
||||||
|
|
@ -348,9 +348,9 @@ audiotestsrc_make_buffer (SpaAudioTestSrc *this)
|
||||||
set_timer (this, true);
|
set_timer (this, true);
|
||||||
|
|
||||||
io->buffer_id = b->outbuf->id;
|
io->buffer_id = b->outbuf->id;
|
||||||
io->status = SPA_RESULT_HAVE_OUTPUT;
|
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||||
|
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -361,7 +361,7 @@ audiotestsrc_on_output (SpaSource *source)
|
||||||
|
|
||||||
res = audiotestsrc_make_buffer (this);
|
res = audiotestsrc_make_buffer (this);
|
||||||
|
|
||||||
if (res == SPA_RESULT_HAVE_OUTPUT)
|
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||||
send_have_output (this);
|
send_have_output (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -850,15 +850,15 @@ spa_audiotestsrc_node_process_output (SpaNode *node)
|
||||||
io = this->io;
|
io = this->io;
|
||||||
spa_return_val_if_fail (io != NULL, SPA_RESULT_WRONG_STATE);
|
spa_return_val_if_fail (io != NULL, SPA_RESULT_WRONG_STATE);
|
||||||
|
|
||||||
if (io->status == SPA_RESULT_HAVE_OUTPUT)
|
if (io->status == SPA_RESULT_HAVE_BUFFER)
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
|
|
||||||
if (io->buffer_id != SPA_ID_INVALID) {
|
if (io->buffer_id != SPA_ID_INVALID) {
|
||||||
reuse_buffer (this, this->io->buffer_id);
|
reuse_buffer (this, this->io->buffer_id);
|
||||||
this->io->buffer_id = SPA_ID_INVALID;
|
this->io->buffer_id = SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->async && (io->status == SPA_RESULT_NEED_INPUT))
|
if (!this->async && (io->status == SPA_RESULT_NEED_BUFFER))
|
||||||
return audiotestsrc_make_buffer (this);
|
return audiotestsrc_make_buffer (this);
|
||||||
else
|
else
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
|
|
||||||
|
|
@ -310,9 +310,9 @@ videotestsrc_make_buffer (SpaVideoTestSrc *this)
|
||||||
set_timer (this, true);
|
set_timer (this, true);
|
||||||
|
|
||||||
io->buffer_id = b->outbuf->id;
|
io->buffer_id = b->outbuf->id;
|
||||||
io->status = SPA_RESULT_HAVE_OUTPUT;
|
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||||
|
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -323,7 +323,7 @@ videotestsrc_on_output (SpaSource *source)
|
||||||
|
|
||||||
res = videotestsrc_make_buffer (this);
|
res = videotestsrc_make_buffer (this);
|
||||||
|
|
||||||
if (res == SPA_RESULT_HAVE_OUTPUT)
|
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||||
send_have_output (this);
|
send_have_output (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -725,13 +725,13 @@ spa_volume_node_process_input (SpaNode *node)
|
||||||
if (sbuf != dbuf)
|
if (sbuf != dbuf)
|
||||||
release_buffer (this, sbuf);
|
release_buffer (this, sbuf);
|
||||||
|
|
||||||
return SPA_RESULT_HAVE_OUTPUT;
|
return SPA_RESULT_HAVE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_volume_node_process_output (SpaNode *node)
|
spa_volume_node_process_output (SpaNode *node)
|
||||||
{
|
{
|
||||||
return SPA_RESULT_NEED_INPUT;
|
return SPA_RESULT_NEED_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SpaNode volume_node = {
|
static const SpaNode volume_node = {
|
||||||
|
|
|
||||||
|
|
@ -225,27 +225,27 @@ on_sink_event (SpaNode *node, SpaEvent *event, void *user_data)
|
||||||
|
|
||||||
res = spa_node_process_output (data->mix);
|
res = spa_node_process_output (data->mix);
|
||||||
|
|
||||||
if (res == SPA_RESULT_NEED_INPUT) {
|
if (res == SPA_RESULT_NEED_BUFFER) {
|
||||||
|
|
||||||
if (data->source1_mix_io[0].status == SPA_RESULT_NEED_INPUT) {
|
if (data->source1_mix_io[0].status == SPA_RESULT_NEED_BUFFER) {
|
||||||
res = spa_node_process_output (data->source1);
|
res = spa_node_process_output (data->source1);
|
||||||
if (res != SPA_RESULT_HAVE_OUTPUT)
|
if (res != SPA_RESULT_HAVE_BUFFER)
|
||||||
printf ("got process_output error from source1 %d\n", res);
|
printf ("got process_output error from source1 %d\n", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->source2_mix_io[0].status == SPA_RESULT_NEED_INPUT) {
|
if (data->source2_mix_io[0].status == SPA_RESULT_NEED_BUFFER) {
|
||||||
res = spa_node_process_output (data->source2);
|
res = spa_node_process_output (data->source2);
|
||||||
if (res != SPA_RESULT_HAVE_OUTPUT)
|
if (res != SPA_RESULT_HAVE_BUFFER)
|
||||||
printf ("got process_output error from source2 %d\n", res);
|
printf ("got process_output error from source2 %d\n", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = spa_node_process_input (data->mix);
|
res = spa_node_process_input (data->mix);
|
||||||
if (res == SPA_RESULT_HAVE_OUTPUT)
|
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||||
goto push;
|
goto push;
|
||||||
else
|
else
|
||||||
printf ("got process_input error from mixer %d\n", res);
|
printf ("got process_input error from mixer %d\n", res);
|
||||||
|
|
||||||
} else if (res == SPA_RESULT_HAVE_OUTPUT) {
|
} else if (res == SPA_RESULT_HAVE_BUFFER) {
|
||||||
push:
|
push:
|
||||||
if ((res = spa_node_process_input (data->sink)) < 0)
|
if ((res = spa_node_process_input (data->sink)) < 0)
|
||||||
printf ("got process_input error from sink %d\n", res);
|
printf ("got process_input error from sink %d\n", res);
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ on_sink_event (SpaNode *node, SpaEvent *event, void *user_data)
|
||||||
|
|
||||||
if (SPA_EVENT_TYPE (event) == data->type.event_node.NeedInput) {
|
if (SPA_EVENT_TYPE (event) == data->type.event_node.NeedInput) {
|
||||||
res = spa_node_process_output (data->source);
|
res = spa_node_process_output (data->source);
|
||||||
if (res != SPA_RESULT_HAVE_OUTPUT)
|
if (res != SPA_RESULT_HAVE_BUFFER)
|
||||||
printf ("got process_output error from source %d\n", res);
|
printf ("got process_output error from source %d\n", res);
|
||||||
|
|
||||||
if ((res = spa_node_process_input (data->sink)) < 0)
|
if ((res = spa_node_process_input (data->sink)) < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue