[Play Counts] Track play counts of correct track

Track play counts for the correct track, even on short tracks. Also
correctly track the play count of the last played item in the play queue
which stops with bufferChain set to nil, so the previous iteration was
not tracking it.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-27 21:46:36 -07:00
parent ae019409c5
commit 2ed78a0639
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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 {