Fix camera race crash during Open/Close (and audio crackling after recording) - #1098
Merged
Merged
Conversation
Serialize the FFmpeg capture Open path with GetFrame and Close using the existing recursive mutex. Close still signals cancellation before waiting, but cannot free a context while avformat_open_input or decoder setup uses it. Clean up partially initialized resources on failure or cancellation. Add a hardware-independent regression test that pauses a V4L2 open inside FFmpeg and requests Close from another thread. It reproduces SIGSEGV with the original implementation and passes with the fix, including 20 repeated runs. All 15 camera/screen capture test cases pass (78 assertions). Real-device AppImage validation remains necessary after rebuilding.
Position PulseAudio and WASAPI loopback samples relative to recording start, dropping stale audio and preserving gaps without delaying subsequent sound. Request smaller PulseAudio fragments and tolerate bounded timestamp jitter to avoid crackling at packet boundaries. Add regression coverage for both capture clocks, pre-recording buffers, late packets, gaps, queue overflow, reset, and sample continuity.
Member
Author
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1098 +/- ##
===========================================
+ Coverage 71.14% 71.44% +0.30%
===========================================
Files 263 264 +1
Lines 34758 34963 +205
===========================================
+ Hits 24727 24980 +253
+ Misses 10031 9983 -48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
No description provided.