Repository navigation
always-available: support disabling recording when the source is offline - #6182
Merged
Merged
Conversation
…luenviron#5587) Add `alwaysAvailableRecorded` parameter that controls whether recording happens during offline periods for always-available paths. When set to false, recording only starts when a real source is connected.
Recording start/stop now rides the shared setOnline/setOffline transitions and the reload gate uses isOnline(). Static-source paths start recording when the source connects, and a config reload while the source is offline no longer records the offline segment. Adds the parameter to the sample configuration and regression tests for both transitions plus the publisher connect/disconnect cycle. Co-authored-by: Abdulrahman Nashaat <abdelrahmanndev@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6182 +/- ##
==========================================
+ Coverage 64.49% 64.52% +0.03%
==========================================
Files 275 275
Lines 23937 23946 +9
==========================================
+ Hits 15438 15452 +14
+ Misses 7261 7252 -9
- Partials 1238 1242 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1 of 2 tasks
Member
|
merged, thanks! |
Contributor
|
This issue is mentioned in release v1.21.0 🚀 |
This was referenced Oct 5, 2026
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.
Supersedes #5767 by @AbdElrahmaN31. Their commit is kept as the first commit of this branch, rebased onto main.
Closes #5587
Problem
With
alwaysAvailable: yesandrecord: yes, the offline segment is recorded whenever the source is offline, so recordings fill up with the placeholder picture. #5767 addsalwaysAvailableRecordedto skip it. It has been open since May without further activity from its author; I left a review on it with the two gaps below and a suggested fix, and it no longer merges cleanly onto main (internal/core/path.go,internal/conf/conf_test.go).Change
New path parameter
alwaysAvailableRecorded(defaulttrue, existing behaviour unchanged). Whenfalse, recording runs only while a source is connected and stops while the offline segment is playing.Reproduction
Config:
alwaysAvailable: yes,alwaysAvailableRecorded: false,record: yes, one H264 track. The three regression tests from this branch, run against the original commit alone, show two gaps:doAddPublisher()only, so a path withsource:set (static source) never started recording when its source connected.doReloadConf()usedpa.source != nilas the online check. That is true for a static source even while it is disconnected, so a reload while offline started recording the offline segment.Fix
Recording start and stop now live in
setOnline()/setOffline(), which publishers and static sources both go through, and the reload check usesisOnline(). Same tests on this branch:Impact
true: no change for existing configurations.mediamtx.ymldocuments the parameter;api/openapi.yamlis regenerated withapidocsgen.