mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 05:57:05 +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"
|
#include "log_util.h"
|
||||||
|
|
||||||
#define RTSP_STACK_SIZE (8*1024)
|
#define RTSP_STACK_SIZE (8*1024)
|
||||||
#define SEARCH_STACK_SIZE (3*1048)
|
#define SEARCH_STACK_SIZE (3*1024)
|
||||||
|
|
||||||
typedef struct raop_ctx_s {
|
typedef struct raop_ctx_s {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
@@ -539,13 +539,11 @@ static void output_thread_i2s(void *arg) {
|
|||||||
output.frames_played_dmp = output.frames_played;
|
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 ...)
|
// 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;
|
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 );
|
_output_frames( iframes );
|
||||||
// oframes must be a global updated by the write callback
|
// oframes must be a global updated by the write callback
|
||||||
output.frames_in_process = oframes;
|
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(oframes,rec,iframes);
|
||||||
SET_MIN_MAX_SIZED(_buf_used(outputbuf),o,outputbuf->size);
|
SET_MIN_MAX_SIZED(_buf_used(outputbuf),o,outputbuf->size);
|
||||||
SET_MIN_MAX_SIZED(_buf_used(streambuf),s,streambuf->size);
|
SET_MIN_MAX_SIZED(_buf_used(streambuf),s,streambuf->size);
|
||||||
@@ -558,7 +556,7 @@ static void output_thread_i2s(void *arg) {
|
|||||||
discard = output.frames_played_dmp ? 0 : output.device_frames;
|
discard = output.frames_played_dmp ? 0 : output.device_frames;
|
||||||
synced = true;
|
synced = true;
|
||||||
} else if (discard) {
|
} else if (discard) {
|
||||||
discard -= oframes;
|
discard -= min(oframes, discard);
|
||||||
iframes = discard ? min(FRAME_BLOCK, discard) : FRAME_BLOCK;
|
iframes = discard ? min(FRAME_BLOCK, discard) : FRAME_BLOCK;
|
||||||
UNLOCK;
|
UNLOCK;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user