diff --git a/Audio/AudioPlayer.h b/Audio/AudioPlayer.h index 6b32151e7..c7e40cbf7 100644 --- a/Audio/AudioPlayer.h +++ b/Audio/AudioPlayer.h @@ -39,6 +39,8 @@ using std::atomic_bool; id nextStreamUserInfo; NSDictionary *nextStreamRGInfo; + id previousUserInfo; // Track currently last heard track for play counts + id delegate; BOOL outputLaunched; diff --git a/Audio/AudioPlayer.m b/Audio/AudioPlayer.m index 7b57b346b..5bd379238 100644 --- a/Audio/AudioPlayer.m +++ b/Audio/AudioPlayer.m @@ -113,6 +113,7 @@ outputLaunched = NO; startedPaused = paused; initialBufferFilled = NO; + previousUserInfo = userInfo; [bufferChain launchThreads]; @@ -296,6 +297,8 @@ - (BOOL)endOfInputReached:(BufferChain *)sender // Sender is a BufferChain { + previousUserInfo = [sender userInfo]; + BufferChain *newChain = nil; if(atomic_load_explicit(&resettingNow, memory_order_relaxed)) @@ -424,9 +427,7 @@ } - (void)reportPlayCount { - if(bufferChain) { - [self reportPlayCountForTrack:[bufferChain userInfo]]; - } + [self reportPlayCountForTrack:previousUserInfo]; } - (BOOL)selectNextBuffer {