mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
bluez5: media-sink: encode next packet as soon as possible
After flushing a packet, encode the next one immediately if we already have the data. This makes the flush timing more accurate (std ~4x smaller) as we don't need to wait for the encode.
This commit is contained in:
parent
031f992981
commit
f05e68e4d4
1 changed files with 3 additions and 5 deletions
|
|
@ -691,11 +691,6 @@ again:
|
||||||
spa_log_trace(this->log, "%p: written %u frames", this, total_frames);
|
spa_log_trace(this->log, "%p: written %u frames", this, total_frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (written > 0 && this->buffer_used == this->header_size) {
|
|
||||||
enable_flush_timer(this, false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->flush_pending) {
|
if (this->flush_pending) {
|
||||||
spa_log_trace(this->log, "%p: wait for flush timer", this);
|
spa_log_trace(this->log, "%p: wait for flush timer", this);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -794,6 +789,9 @@ again:
|
||||||
this->next_flush_time, this->process_time);
|
this->next_flush_time, this->process_time);
|
||||||
reset_buffer(this);
|
reset_buffer(this);
|
||||||
enable_flush_timer(this, true);
|
enable_flush_timer(this, true);
|
||||||
|
|
||||||
|
/* Encode next packet already now; it will be flushed later on timer */
|
||||||
|
goto again;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Don't want to flush yet, or failed to write anything */
|
/* Don't want to flush yet, or failed to write anything */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue