Skip to content

Commit

Permalink
Fix webstream playlist abort when track fails (#276), thanks to @laszloh
Browse files Browse the repository at this point in the history
 !
  • Loading branch information
tueddy committed Dec 9, 2023
1 parent 367e31f commit af0b078
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## DEV-branch

* 08.12.2023: Fix webstream playlist abort when track fails (#276), thanks to @laszloh !
* 09.12.2023: Fix webstream playlist abort when track fails (#276), thanks to @laszloh !
* 07.12.2023: Show RC522 firmware version at startup, same as PN5180
* 04.12.2023: fix stuttering sound with some WAV & MP3 files, thanks to @wolle !
* 04.12.2023: change trackprogress communication from websocket to http to improve stability
Expand Down
24 changes: 12 additions & 12 deletions src/AudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void AudioPlayer_Task(void *parameter) {
#endif

constexpr uint32_t playbackTimeout = 2000;
uint32_t playbackTimeoutStart = 0;
uint32_t playbackTimeoutStart = millis();

AudioPlayer_CurrentVolume = AudioPlayer_GetInitVolume();
audio->setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
Expand Down Expand Up @@ -404,12 +404,19 @@ void AudioPlayer_Task(void *parameter) {
trackQStatus = xQueueReceive(gTrackQueue, &gPlayProperties.playlist, 0);
if (trackQStatus == pdPASS || gPlayProperties.trackFinished || trackCommand != NO_ACTION) {
if (trackQStatus == pdPASS) {
if (gPlayProperties.pausePlay) {
gPlayProperties.pausePlay = false;
}
audio->stopSong();
Log_Printf(LOGLEVEL_NOTICE, newPlaylistReceived, gPlayProperties.numberOfTracks);
Log_Printf(LOGLEVEL_DEBUG, "Free heap: %u", ESP.getFreeHeap());
playbackTimeoutStart = millis();
gPlayProperties.pausePlay = false;
gPlayProperties.repeatCurrentTrack = false;
gPlayProperties.repeatPlaylist = false;
gPlayProperties.sleepAfterCurrentTrack = false;
gPlayProperties.sleepAfterPlaylist = false;
gPlayProperties.saveLastPlayPosition = false;
gPlayProperties.playUntilTrackNumber = 0;
gPlayProperties.trackFinished = false;
gPlayProperties.playlistFinished = false;

#ifdef MQTT_ENABLE
publishMqtt(topicPlaymodeState, gPlayProperties.playMode, false);
Expand All @@ -424,7 +431,7 @@ void AudioPlayer_Task(void *parameter) {
}
if (gPlayProperties.trackFinished) {
gPlayProperties.trackFinished = false;
if (gPlayProperties.playMode == NO_PLAYLIST) {
if (gPlayProperties.playMode == NO_PLAYLIST || gPlayProperties.playlist == nullptr) {
gPlayProperties.playlistFinished = true;
continue;
}
Expand Down Expand Up @@ -984,13 +991,6 @@ void AudioPlayer_TrackQueueDispatcher(const char *_itemToPlay, const uint32_t _l

gPlayProperties.playMode = _playMode;
gPlayProperties.numberOfTracks = strtoul(*(musicFiles - 1), NULL, 10);
// Set some default-values
gPlayProperties.repeatCurrentTrack = false;
gPlayProperties.repeatPlaylist = false;
gPlayProperties.sleepAfterCurrentTrack = false;
gPlayProperties.sleepAfterPlaylist = false;
gPlayProperties.saveLastPlayPosition = false;
gPlayProperties.playUntilTrackNumber = 0;

#ifdef PLAY_LAST_RFID_AFTER_REBOOT
// Store last RFID-tag to NVS
Expand Down
2 changes: 1 addition & 1 deletion src/revision.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "gitrevision.h"
constexpr const char softwareRevision[] = "Software-revision: 20231208-1-DEV";
constexpr const char softwareRevision[] = "Software-revision: 20231209-1-DEV";

0 comments on commit af0b078

Please sign in to comment.