mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
parent
d2ff341263
commit
6566f52a7e
1 changed files with 8 additions and 5 deletions
|
|
@ -353,6 +353,11 @@ static int send_buffer(struct impl *this)
|
|||
return written;
|
||||
}
|
||||
|
||||
static bool need_flush(struct impl *this)
|
||||
{
|
||||
return (this->frame_count + 1 >= this->num_blocks);
|
||||
}
|
||||
|
||||
static int encode_buffer(struct impl *this, const void *data, uint32_t size)
|
||||
{
|
||||
int processed;
|
||||
|
|
@ -365,6 +370,9 @@ static int encode_buffer(struct impl *this, const void *data, uint32_t size)
|
|||
this, size, this->buffer_used, port->frame_size, this->block_size,
|
||||
this->frame_count);
|
||||
|
||||
if (need_flush(this))
|
||||
return 0;
|
||||
|
||||
if (this->buffer_used >= sizeof(this->buffer))
|
||||
return -ENOSPC;
|
||||
|
||||
|
|
@ -401,11 +409,6 @@ static int encode_buffer(struct impl *this, const void *data, uint32_t size)
|
|||
return processed;
|
||||
}
|
||||
|
||||
static bool need_flush(struct impl *this)
|
||||
{
|
||||
return (this->frame_count + 1 >= this->num_blocks);
|
||||
}
|
||||
|
||||
static int flush_buffer(struct impl *this, bool force)
|
||||
{
|
||||
spa_log_trace(this->log, NAME" %p: used:%d num_blocks:%d block_size%d", this,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue