mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
resample: use a 0 sized buffer to drain
This commit is contained in:
parent
7febf7ea25
commit
fdb5911e86
2 changed files with 18 additions and 1 deletions
|
|
@ -780,6 +780,12 @@ static int impl_node_process(void *object)
|
||||||
flush_out = true;
|
flush_out = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (size == 0) {
|
||||||
|
size = sb->datas[0].maxsize;
|
||||||
|
memset(sb->datas[0].data, 0, size);
|
||||||
|
inport->offset = 0;
|
||||||
|
flush_in = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->io_rate_match) {
|
if (this->io_rate_match) {
|
||||||
if (SPA_FLAG_IS_SET(this->io_rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE)) {
|
if (SPA_FLAG_IS_SET(this->io_rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE)) {
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ struct stream {
|
||||||
unsigned int disconnecting:1;
|
unsigned int disconnecting:1;
|
||||||
unsigned int free_proxy:1;
|
unsigned int free_proxy:1;
|
||||||
unsigned int draining:1;
|
unsigned int draining:1;
|
||||||
|
unsigned int drained:1;
|
||||||
unsigned int allow_mlock:1;
|
unsigned int allow_mlock:1;
|
||||||
unsigned int warn_mlock:1;
|
unsigned int warn_mlock:1;
|
||||||
};
|
};
|
||||||
|
|
@ -781,6 +782,14 @@ again:
|
||||||
io->buffer_id = SPA_ID_INVALID;
|
io->buffer_id = SPA_ID_INVALID;
|
||||||
io->status = SPA_STATUS_NEED_DATA;
|
io->status = SPA_STATUS_NEED_DATA;
|
||||||
pw_log_trace(NAME" %p: no more buffers %p", stream, io);
|
pw_log_trace(NAME" %p: no more buffers %p", stream, io);
|
||||||
|
if (impl->draining && !impl->drained) {
|
||||||
|
b = pop_queue(impl, &impl->dequeued);
|
||||||
|
io->buffer_id = b->id;
|
||||||
|
io->status = SPA_STATUS_HAVE_DATA;
|
||||||
|
b->this.buffer->datas[0].chunk->size = 0;
|
||||||
|
pw_log_trace(NAME" %p: drain buffer %d", stream, b->id);
|
||||||
|
impl->drained = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1040,7 +1049,7 @@ static void context_xrun(void *data, struct pw_impl_node *node)
|
||||||
struct stream *impl = data;
|
struct stream *impl = data;
|
||||||
if (impl->node != node)
|
if (impl->node != node)
|
||||||
return;
|
return;
|
||||||
if (impl->draining)
|
if (impl->draining && impl->drained)
|
||||||
call_drained(impl);
|
call_drained(impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1785,7 +1794,9 @@ do_drain(struct spa_loop *loop,
|
||||||
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
||||||
{
|
{
|
||||||
struct stream *impl = user_data;
|
struct stream *impl = user_data;
|
||||||
|
pw_log_trace(NAME" %p", impl);
|
||||||
impl->draining = true;
|
impl->draining = true;
|
||||||
|
impl->drained = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue