mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
fix another ancient bug with sync start time (visible with AirPlay and SPDIF, but impacts all)
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
#include "log_util.h"
|
||||
|
||||
#define RTSP_STACK_SIZE (8*1024)
|
||||
#define SEARCH_STACK_SIZE (3*1048)
|
||||
#define SEARCH_STACK_SIZE (3*1024)
|
||||
|
||||
typedef struct raop_ctx_s {
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -539,13 +539,11 @@ static void output_thread_i2s(void *arg) {
|
||||
output.frames_played_dmp = output.frames_played;
|
||||
// try to estimate how much we have consumed from the DMA buffer (calculation is incorrect at the very beginning ...)
|
||||
output.device_frames = dma_buf_frames - ((output.updated - fullness) * output.current_sample_rate) / 1000;
|
||||
// we'll try to produce iframes if we have any, but we might return less if outpuf does not have enough
|
||||
_output_frames( iframes );
|
||||
// oframes must be a global updated by the write callback
|
||||
output.frames_in_process = oframes;
|
||||
|
||||
// force some sin
|
||||
//memcpy(obuf, __obuf, oframes*BYTES_PER_FRAME);
|
||||
|
||||
SET_MIN_MAX_SIZED(oframes,rec,iframes);
|
||||
SET_MIN_MAX_SIZED(_buf_used(outputbuf),o,outputbuf->size);
|
||||
SET_MIN_MAX_SIZED(_buf_used(streambuf),s,streambuf->size);
|
||||
@@ -558,8 +556,8 @@ static void output_thread_i2s(void *arg) {
|
||||
discard = output.frames_played_dmp ? 0 : output.device_frames;
|
||||
synced = true;
|
||||
} else if (discard) {
|
||||
discard -= oframes;
|
||||
iframes = discard ? min(FRAME_BLOCK, discard) : FRAME_BLOCK;
|
||||
discard -= min(oframes, discard);
|
||||
iframes = discard ? min(FRAME_BLOCK, discard) : FRAME_BLOCK;
|
||||
UNLOCK;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user