mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-13 06:57:07 +03:00
fix flush mode
This commit is contained in:
@@ -443,7 +443,7 @@ void output_close_common(void) {
|
||||
}
|
||||
|
||||
void output_flush(void) {
|
||||
LOG_INFO("flush output buffer");
|
||||
LOG_INFO("flush output buffer (full)");
|
||||
buf_flush(outputbuf);
|
||||
LOCK;
|
||||
output.fade = FADE_INACTIVE;
|
||||
@@ -457,3 +457,15 @@ void output_flush(void) {
|
||||
output.frames_played = 0;
|
||||
UNLOCK;
|
||||
}
|
||||
|
||||
bool output_flush_streaming(void) {
|
||||
LOG_INFO("flush output buffer (streaming)");
|
||||
LOCK;
|
||||
bool flushed = output.track_start != NULL;
|
||||
if (output.track_start) {
|
||||
outputbuf->writep = output.track_start;
|
||||
output.track_start = NULL;
|
||||
}
|
||||
UNLOCK;
|
||||
return flushed;
|
||||
}
|
||||
|
||||
@@ -305,8 +305,18 @@ static void process_strm(u8_t *pkt, int len) {
|
||||
sendSTAT("STMt", strm->replay_gain); // STMt replay_gain is no longer used to track latency, but support it
|
||||
break;
|
||||
case 'f':
|
||||
{
|
||||
decode_flush(false);
|
||||
bool flushed = false;
|
||||
if (!output.external) flushed |= output_flush_streaming();
|
||||
// we can have fully finished the current streaming, that's still a flush
|
||||
if (stream_disconnect() || flushed) sendSTAT("STMf", 0);
|
||||
buf_flush(streambuf);
|
||||
output.stop_time = gettime_ms();
|
||||
break;
|
||||
}
|
||||
case 'q':
|
||||
decode_flush(strm->command == 'q');
|
||||
decode_flush(true);
|
||||
if (!output.external) output_flush();
|
||||
status.frames_played = 0;
|
||||
if (stream_disconnect() && strm->command == 'f') sendSTAT("STMf", 0);
|
||||
|
||||
@@ -727,6 +727,7 @@ struct outputstate {
|
||||
void output_init_common(log_level level, const char *device, unsigned output_buf_size, unsigned rates[], unsigned idle);
|
||||
void output_close_common(void);
|
||||
void output_flush(void);
|
||||
bool output_flush_streaming(void);
|
||||
// _* called with mutex locked
|
||||
frames_t _output_frames(frames_t avail);
|
||||
void _checkfade(bool);
|
||||
|
||||
Reference in New Issue
Block a user