[vlc-commits] [Git][videolan/vlc][master] 2 commits: avsb: move _timeQueue waiting

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Aug 10 09:17:59 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f4a4ebfd by Thomas Guillem at 2024-08-10T08:56:10+00:00
avsb: move _timeQueue waiting

It will be faster to wait at the end of the function after we signalled
all components that they need to stop.

It is possible since whenTimeObserved() does not require any others
components that are stopping.

The downside is that a timing has more chance to be reported while
stopping, but it is legal (it should not be reported after stop).

- - - - -
8a4a0af2 by Thomas Guillem at 2024-08-10T08:56:10+00:00
avsb: fix use-after-free in wrapBuffer when stopping

use-after-free with _fmtDesc. This variable is released from
stop(), but whenDataReady() could still be called during and after
stop().

- - - - -


1 changed file:

- modules/audio_output/apple/avsamplebuffer.m


Changes:

=====================================
modules/audio_output/apple/avsamplebuffer.m
=====================================
@@ -305,9 +305,6 @@ customBlock_Free(void *refcon, void *doomedMemoryBlock, size_t sizeInBytes)
     _sync.rate = 0.0f;
 
     [_sync removeTimeObserver:_observer];
-    /* From the doc: "Call dispatch_sync after removeTimeObserver: to wait for
-     * any in-flight blocks to finish executing." */
-    dispatch_sync(_timeQueue, ^{});
 
     [_renderer stopRequestingMediaData];
     [_renderer flush];
@@ -321,6 +318,14 @@ customBlock_Free(void *refcon, void *doomedMemoryBlock, size_t sizeInBytes)
 
     vlc_cond_signal(&_bufferWait);
     vlc_mutex_unlock(&_bufferLock);
+
+    /* From the doc: "Call dispatch_sync after removeTimeObserver: to wait for
+     * any in-flight blocks to finish executing." */
+    dispatch_sync(_timeQueue, ^{});
+
+    /* Not in any doc:, stopRequestingMediaData() and flush() won't wait for
+     * any blocks to finish executing, so wait here. */
+     dispatch_sync(_dataQueue, ^{});
 }
 
 - (void)stop



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd5b87fb6d4de4e533f04b00040c4c98d12466b3...8a4a0af2443a98852a168a16ce548398ce0d094f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd5b87fb6d4de4e533f04b00040c4c98d12466b3...8a4a0af2443a98852a168a16ce548398ce0d094f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list