mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
Stabilize sync on A2DP
This commit is contained in:
@@ -295,6 +295,9 @@ static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
|
||||
SET_MIN_MAX(len,req);
|
||||
TIME_MEASUREMENT_START(start_timer);
|
||||
LOCK;
|
||||
output.device_frames = 0; // todo: check if this is the right way do to this.
|
||||
output.updated = gettime_ms();
|
||||
output.frames_played_dmp = output.frames_played;
|
||||
SET_MIN_MAX_SIZED(_buf_used(outputbuf),bt,outputbuf->size);
|
||||
do {
|
||||
avail_data = _output_frames( wanted_len/BYTES_PER_FRAME )*BYTES_PER_FRAME; // Keep the transfer buffer full
|
||||
@@ -304,9 +307,7 @@ static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
|
||||
{
|
||||
SET_MIN_MAX(wanted_len, under);
|
||||
}
|
||||
output.device_frames = 0; // todo: check if this is the right way do to this.
|
||||
output.updated = gettime_ms();
|
||||
output.frames_played_dmp = output.frames_played;
|
||||
|
||||
UNLOCK;
|
||||
SET_MIN_MAX(TIME_MEASUREMENT_GET(start_timer),lock_out_time);
|
||||
SET_MIN_MAX((len-wanted_len), rec);
|
||||
|
||||
@@ -291,6 +291,9 @@ static void *output_thread_dac() {
|
||||
continue;
|
||||
}
|
||||
LOG_SDEBUG("Current buffer free: %10d, cont read: %10d",_buf_space(dacbuffer),_buf_cont_read(dacbuffer));
|
||||
output.device_frames =0;
|
||||
output.updated = gettime_ms();
|
||||
output.frames_played_dmp = output.frames_played;
|
||||
|
||||
do{
|
||||
// fill our buffer
|
||||
@@ -313,7 +316,6 @@ static void *output_thread_dac() {
|
||||
SET_MIN_MAX_SIZED(_buf_used(dacbuffer),loci2sbuf,dacbuffer->size);
|
||||
bytes_to_send_i2s = _buf_cont_read(dacbuffer);
|
||||
SET_MIN_MAX(bytes_to_send_i2s,i2savailable);
|
||||
int pass=0;
|
||||
i2s_total_bytes_written=0;
|
||||
|
||||
while (bytes_to_send_i2s>0 )
|
||||
@@ -353,9 +355,6 @@ static void *output_thread_dac() {
|
||||
SET_MIN_MAX(bytes_to_send_i2s,i2savailable);
|
||||
|
||||
}
|
||||
output.device_frames =0;
|
||||
output.updated = gettime_ms();
|
||||
output.frames_played_dmp = output.frames_played;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user