mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
bluez5: fix decode-buffer buffering threshold
The minimum is the number of requested samples, not duration, which can be different when resampling.
This commit is contained in:
parent
ff81fc9f7b
commit
cee0c39b00
1 changed files with 3 additions and 3 deletions
|
|
@ -259,7 +259,7 @@ static inline void spa_bt_decode_buffer_process(struct spa_bt_decode_buffer *thi
|
||||||
|
|
||||||
spa_log_trace(this->log, "%p buffering size:%d", this, (int)size);
|
spa_log_trace(this->log, "%p buffering size:%d", this, (int)size);
|
||||||
|
|
||||||
if (size >= SPA_MAX((int)duration, target))
|
if (size >= SPA_MAX((int)samples, target))
|
||||||
this->buffering = false;
|
this->buffering = false;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
@ -275,7 +275,7 @@ static inline void spa_bt_decode_buffer_process(struct spa_bt_decode_buffer *thi
|
||||||
|
|
||||||
spa_bt_ptp_update(&this->spike, (int32_t)this->ctl.avg - this->level, duration);
|
spa_bt_ptp_update(&this->spike, (int32_t)this->ctl.avg - this->level, duration);
|
||||||
|
|
||||||
if (this->level > SPA_MAX(4 * target, 3*(int32_t)duration) &&
|
if (this->level > SPA_MAX(4 * target, 3*(int32_t)samples) &&
|
||||||
avail > data_size) {
|
avail > data_size) {
|
||||||
/* Lagging too much: drop data */
|
/* Lagging too much: drop data */
|
||||||
uint32_t size = SPA_MIN(avail - data_size,
|
uint32_t size = SPA_MIN(avail - data_size,
|
||||||
|
|
@ -307,7 +307,7 @@ static inline void spa_bt_decode_buffer_process(struct spa_bt_decode_buffer *thi
|
||||||
this->level, target, duration, avg_period,
|
this->level, target, duration, avg_period,
|
||||||
BUFFERING_RATE_DIFF_MAX);
|
BUFFERING_RATE_DIFF_MAX);
|
||||||
|
|
||||||
this->level -= duration;
|
this->level -= samples;
|
||||||
|
|
||||||
spa_bt_decode_buffer_get_read(this, &avail);
|
spa_bt_decode_buffer_get_read(this, &avail);
|
||||||
if (avail < data_size) {
|
if (avail < data_size) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue