From 5e36affad891c7268300642cf3d098bc5913669c Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 2 Oct 2023 06:47:57 -0700 Subject: [PATCH] Hopefully fix crashes from rapidly skipping files Do this by serializing the background thread actions against the AudioPlayer object, so we don't start playback multiple times at once. Signed-off-by: Christopher Snowhill --- Audio/AudioPlayer.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Audio/AudioPlayer.m b/Audio/AudioPlayer.m index 98077054e..5311815c0 100644 --- a/Audio/AudioPlayer.m +++ b/Audio/AudioPlayer.m @@ -57,7 +57,9 @@ } - (void)playBG:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi startPaused:(NSNumber *)paused andSeekTo:(NSNumber *)time { - [self play:url withUserInfo:userInfo withRGInfo:rgi startPaused:[paused boolValue] andSeekTo:[time doubleValue]]; + @synchronized (self) { + [self play:url withUserInfo:userInfo withRGInfo:rgi startPaused:[paused boolValue] andSeekTo:[time doubleValue]]; + } } - (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi startPaused:(BOOL)paused andSeekTo:(double)time {