Codebase list squeezelite / dc6ea16
issue 86: change decode state machine to avoid restarting track decode when complete Adrian Smith 9 years ago
4 changed file(s) with 8 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
239239
240240 codec->open(sample_size, sample_rate, channels, endianness);
241241
242 decode.state = DECODE_READY;
243
242244 UNLOCK_D;
243245 return;
244246 }
7373 SOXR(r, process, r->resampler, process->inbuf, process->in_frames, &idone, process->outbuf, process->max_out_frames, &odone);
7474 if (error) {
7575 LOG_INFO("soxr_process error: %s", soxr_strerror(error));
76 return;
7677 }
7778
7879 if (idone != process->in_frames) {
99100 soxr_error_t error = SOXR(r, process, r->resampler, NULL, 0, NULL, process->outbuf, process->max_out_frames, &odone);
100101 if (error) {
101102 LOG_INFO("soxr_process error: %s", soxr_strerror(error));
103 return true;
102104 }
103105
104106 process->out_frames = odone;
279279 output.state = jiffies ? OUTPUT_START_AT : OUTPUT_RUNNING;
280280 output.start_at = jiffies;
281281 UNLOCK_O;
282 LOCK_D;
283 decode.state = DECODE_RUNNING;
284 UNLOCK_D;
285282 LOG_DEBUG("unpause at: %u now: %u", jiffies, gettime_ms());
286283 sendSTAT("STMr", 0);
287284 }
629626 status.last = now;
630627 }
631628 if ((status.stream_state == STREAMING_HTTP || status.stream_state == STREAMING_FILE) && !sentSTMl
632 && decode.state == DECODE_STOPPED) {
629 && decode.state == DECODE_READY) {
633630 if (autostart == 0) {
631 decode.state = DECODE_RUNNING;
634632 _sendSTMl = true;
635633 sentSTMl = true;
636634 } else if (autostart == 1) {
1919
2020 // make may define: PORTAUDIO, SELFPIPE, RESAMPLE, RESAMPLE_MP, VISEXPORT, DSD, LINKALL to influence build
2121
22 #define VERSION "v1.7"
22 #define VERSION "v1.7.1-beta"
2323
2424 #if !defined(MODEL_NAME)
2525 #define MODEL_NAME SqueezeLite
447447 bool stream_disconnect(void);
448448
449449 // decode.c
450 typedef enum { DECODE_STOPPED = 0, DECODE_RUNNING, DECODE_COMPLETE, DECODE_ERROR } decode_state;
450 typedef enum { DECODE_STOPPED = 0, DECODE_READY, DECODE_RUNNING, DECODE_COMPLETE, DECODE_ERROR } decode_state;
451451
452452 struct decodestate {
453453 decode_state state;