Repository navigation
video_renderer: serialize renderer access across threads - #600
Open
danieldhaiti wants to merge 1 commit into
Open
danieldhaiti wants to merge 1 commit into
danieldhaiti wants to merge 1 commit into
Conversation
The mirror thread (codec choice, frame push), the http thread (HLS control) and the main loop (bus callback, resets) all touch renderer, renderer_type[] and hls_video with no locking, so video_renderer_choose_codec() could use a renderer being freed on another thread. Serialize every public renderer function and the bus callback with one recursive lock. On /stop, replace the player with the normal renderer immediately (as already done at end of video), since the client often starts mirroring right after /stop. A mirror stream arriving before the HLS player is replaced now logs and drops the connection instead of aborting on g_assert.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mirror thread (codec choice, frame push), the http thread (HLS control) and the main loop (bus callback, resets) all touch
renderer,renderer_type[]andhls_videowith no locking. b3202df NULLs destroyed renderers, but another thread can still check a renderer and then use it after it is freed (segfault invideo_renderer_choose_codecwhen iOS re-SETUPs mirror right after HLS/stop).g_autoptr(GRecMutexLocker), needs GLib >= 2.60)./stop, replace the player with the normal renderer straight away (as already done at end of video).g_assert(!hls_video)inchoose_codecbecomes a loggedreturn -1: a mirror stream arriving before the HLS player is replaced drops the connection instead of aborting.Tested: builds on Ubuntu (GStreamer 1.28, Release), no new warnings. 200 concurrent
/stoprequests caused 200 inline rebuilds with no crash or assert and a clean exit. I could not drive a real mirror session from the test rig, so the original race was verified on an appliance with an iPhone (earlier fork base), not reproduced here. Complements the restart-request PR; no conflicts when both are applied.