Audio support + DVR muxing rewrite - #139
Open
henkwiedig wants to merge 12 commits into
Open
Conversation
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.
Audio support + DVR muxing rewrite
Summary
Adds Opus audio to the ground station (live playback + recording) and, to make
recorded A/V stay in sync, replaces the minimp4 DVR muxer with in-pipeline
GStreamer
splitmuxsinkrecorders. Net −3,000 LOC (the vendoredminimp4.hand the old
Dvrclass are gone).The air unit already muxes Opus into the same RTP flow as the video (split by
payload type); this branch consumes it.
Features
Live audio playback (opt-in)
--audioenables an Opus branch teed off the RTP flow:rtpopusdepay → opusdec → audioconvert → audioresample → volume → alsasink.--audio-device <card>or live from the OSD(System → Receiver → Output); accepts a
/proc/asound/cardsid or a full ALSAdevice string.
volumeelement, 0–100%, live via OSD slider (works evenon cards with no hardware mixer, e.g. HDMI).
audio_stack_available()pre-flight checks theOpus/ALSA plugins and that the selected sink actually opens; if not, it silently
drops to video-only so
--audiocan never take the video feed down. The OSDswitch reports the effective state.
Air-side (VTX) audio menu
majestic.yaml.audio.*over SSH.DVR rewrite (the big change)
The old raw DVR re-stamped video to a fixed framerate while audio kept the air
timestamps → A/V drift. Both DVR paths now record in-pipeline via
splitmuxsink+mp4mux, so video and Opus share one timebase:Perfectly synced.
appsrcand muxed with the same Opus into a second mp4. (Live mux, since the re-encoded
video is on a different clock — small constant offset, no drift.)
--dvr-mode raw|reencode|both, size-splitting, and--dvr-sequenced-filesnaming (_raw/_reencsuffixes in BOTH mode).Notable fix: dynamically adding two
splitmuxsinks to a live pipelinedeadlocked both (async state change back-pressured the pipeline → 0-byte/missing
files). Fixed with
async-handling=TRUEon each record bin + sink.Cleanup
src/minimp4.h(~3,500 lines) and the entireDvrclass(
dvr.cpp559 → 60 lines) — dead once both recorders moved tosplitmuxsink.timestamps).
--dvr-framerateis now deprecated — still accepted (won't break existinglaunch scripts) but logs a warning and is ignored.
Robustness
alsasinkat 100% CPU and grow memory unbounded (error spam accumulating on anunwatched bus). The pull thread now drains the bus and, on an
audio_sinkerror,rebuilds video-only — audio drops cleanly instead of taking video down with it.
Breaking changes / migration
--dvr-framerate/PIXELPILOT_DVR_FRAMERATEare no longer needed (removed from the env file; theflag is kept as a deprecated no-op).
isomp4(mp4mux) +multifile(splitmuxsink) good-plugins in addition to the audio-playback plugins.
Testing
splitmuxsinkA/V muxing + size-splitting, the appsrc reencodepath (h264 4.97s / opus 5.01s, in sync), BOTH-mode simultaneous start (5/5
reliable after the async-handling fix), the sink-disconnect bus detection, and
the filename/sequence logic.
audio via USB headset.
Fixes: