[Play Events] Don't bug on end of playlist

Don't bug out on end of playlist, when didBeginStream will receive a nil
track pointer, which should result in unsetting the current track in the
player, and not send a DidBegin notification to everything, including
the visualization views' event handlers.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
lastfm
Christopher Snowhill 2022-06-26 05:28:43 -07:00
parent 5c4cfb4053
commit 8068a506b9
1 changed files with 8 additions and 3 deletions

View File

@ -617,12 +617,15 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
// Delay the action until this function has returned to the audio thread // Delay the action until this function has returned to the audio thread
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
[[FIRCrashlytics crashlytics] logWithFormat:@"Updating UI with track: %@", pe.url]; if(pe) {
[[FIRCrashlytics crashlytics] logWithFormat:@"Updating UI with track: %@", pe.url];
}
[self->playlistController setCurrentEntry:pe]; [self->playlistController setCurrentEntry:pe];
if(self->_eq) if(pe && self->_eq) {
equalizerApplyGenre(self->_eq, [pe genre]); equalizerApplyGenre(self->_eq, [pe genre]);
}
self->lastPosition = -10; self->lastPosition = -10;
@ -631,7 +634,9 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
[self removeHDCD:nil]; [self removeHDCD:nil];
}); });
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidBeginNotficiation object:pe]; if(pe) {
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidBeginNotficiation object:pe];
}
} }
- (void)audioPlayer:(AudioPlayer *)player didChangeStatus:(NSNumber *)s userInfo:(id)userInfo { - (void)audioPlayer:(AudioPlayer *)player didChangeStatus:(NSNumber *)s userInfo:(id)userInfo {