Skip to content

Commit

Permalink
Merge pull request ralph-irving#194: differentiate flush from quit.
Browse files Browse the repository at this point in the history
Thanks philippe44.
Increase squeezelite revision to 1460.

(cherry picked from commit c18ab87)
  • Loading branch information
troudbal committed May 20, 2024
1 parent 4aed821 commit 58cf871
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 13 additions & 1 deletion output.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void output_close_common(void) {
}

void output_flush(void) {
LOG_SQ_INFO("flush output buffer");
LOG_SQ_INFO("flush output buffer (full)");
buf_flush(outputbuf);
LOCK;
output.fade = FADE_INACTIVE;
Expand All @@ -451,3 +451,15 @@ void output_flush(void) {
output.frames_played = 0;
UNLOCK;
}

bool output_flush_streaming(void) {
LOG_SQ_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;
}
18 changes: 10 additions & 8 deletions slimproto.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,17 @@ static void process_strm(u8_t *pkt, int len) {
sendSTAT("STMf", 0);
buf_flush(streambuf);
break;
case 'f':
decode_flush();
output_flush();
status.frames_played = 0;
if (stream_disconnect()) {
sendSTAT("STMf", 0);
case 'f':
{
decode_flush();
// we can have fully finished the current streaming, that's still a flush
bool flushed = output_flush_streaming();
if (stream_disconnect() || flushed) {
sendSTAT("STMf", 0);
}
buf_flush(streambuf);
break;
}
buf_flush(streambuf);
break;
case 'p':
{
unsigned interval = unpackN(&strm->replay_gain);
Expand Down
3 changes: 2 additions & 1 deletion squeezelite.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define MAJOR_VERSION "1.9"
#define MINOR_VERSION "9"
#define MICRO_VERSION "1457"
#define MICRO_VERSION "1460"

#if defined(CUSTOM_VERSION)
#define VERSION "v" MAJOR_VERSION "." MINOR_VERSION "-" MICRO_VERSION STR(CUSTOM_VERSION)
Expand Down Expand Up @@ -688,6 +688,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);
Expand Down

0 comments on commit 58cf871

Please sign in to comment.