mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
bluez5: set io status properly when sink is not going to consume
When sink is not ready to consume buffers, set io and status to indicate it already has data.
This commit is contained in:
parent
cfd422854f
commit
81aaf0e204
2 changed files with 27 additions and 12 deletions
|
|
@ -1083,7 +1083,7 @@ static void media_on_timeout(struct spa_source *source)
|
|||
uint32_t rate;
|
||||
struct spa_io_buffers *io = port->io;
|
||||
uint64_t prev_time, now_time;
|
||||
int res;
|
||||
int status, res;
|
||||
|
||||
if (this->started) {
|
||||
if ((res = spa_system_timerfd_read(this->data_system, this->timerfd, &exp)) < 0) {
|
||||
|
|
@ -1131,10 +1131,12 @@ static void media_on_timeout(struct spa_source *source)
|
|||
this->clock->delay = (delay_nsec * this->clock->rate.denom) / SPA_NSEC_PER_SEC;
|
||||
}
|
||||
|
||||
status = this->transport_started ? SPA_STATUS_NEED_DATA : SPA_STATUS_HAVE_DATA;
|
||||
|
||||
spa_log_trace(this->log, "%p: %d", this, io->status);
|
||||
io->status = SPA_STATUS_NEED_DATA;
|
||||
spa_node_call_ready(&this->callbacks, SPA_STATUS_NEED_DATA);
|
||||
spa_log_trace(this->log, "%p: %d -> %d", this, io->status, status);
|
||||
io->status = status;
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
spa_node_call_ready(&this->callbacks, status);
|
||||
|
||||
set_timeout(this, this->next_time);
|
||||
}
|
||||
|
|
@ -1847,8 +1849,13 @@ static int impl_node_process(void *object)
|
|||
return SPA_STATUS_HAVE_DATA;
|
||||
}
|
||||
|
||||
if (!this->started || !this->transport_started)
|
||||
return SPA_STATUS_OK;
|
||||
if (!this->started || !this->transport_started) {
|
||||
if (io->status != SPA_STATUS_HAVE_DATA) {
|
||||
io->status = SPA_STATUS_HAVE_DATA;
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
return SPA_STATUS_HAVE_DATA;
|
||||
}
|
||||
|
||||
if (io->status == SPA_STATUS_HAVE_DATA && io->buffer_id < port->n_buffers) {
|
||||
struct buffer *b = &port->buffers[io->buffer_id];
|
||||
|
|
|
|||
|
|
@ -586,7 +586,7 @@ static void sco_on_timeout(struct spa_source *source)
|
|||
uint32_t rate;
|
||||
struct spa_io_buffers *io = port->io;
|
||||
uint64_t prev_time, now_time;
|
||||
int res;
|
||||
int status, res;
|
||||
|
||||
if (this->started) {
|
||||
if ((res = spa_system_timerfd_read(this->data_system, this->timerfd, &exp)) < 0) {
|
||||
|
|
@ -622,9 +622,12 @@ static void sco_on_timeout(struct spa_source *source)
|
|||
this->clock->delay = 0;
|
||||
}
|
||||
|
||||
spa_log_trace(this->log, "%p: %d", this, io->status);
|
||||
io->status = SPA_STATUS_NEED_DATA;
|
||||
spa_node_call_ready(&this->callbacks, SPA_STATUS_NEED_DATA);
|
||||
status = this->transport_started ? SPA_STATUS_NEED_DATA : SPA_STATUS_HAVE_DATA;
|
||||
|
||||
spa_log_trace(this->log, "%p: %d -> %d", this, io->status, status);
|
||||
io->status = status;
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
spa_node_call_ready(&this->callbacks, status);
|
||||
|
||||
set_timeout(this, this->next_time);
|
||||
}
|
||||
|
|
@ -1296,8 +1299,13 @@ static int impl_node_process(void *object)
|
|||
return SPA_STATUS_HAVE_DATA;
|
||||
}
|
||||
|
||||
if (!this->started || !this->transport_started)
|
||||
return SPA_STATUS_OK;
|
||||
if (!this->started || !this->transport_started) {
|
||||
if (io->status != SPA_STATUS_HAVE_DATA) {
|
||||
io->status = SPA_STATUS_HAVE_DATA;
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
return SPA_STATUS_HAVE_DATA;
|
||||
}
|
||||
|
||||
if (io->status == SPA_STATUS_HAVE_DATA && io->buffer_id < port->n_buffers) {
|
||||
struct buffer *b = &port->buffers[io->buffer_id];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue