Minimal set of changes for allowing faster than realtime recording (non live)#1192
Merged
Conversation
…mixing, different feeding tempo
…add a bool method, linter fixes
biglittlebigben
approved these changes
Apr 17, 2026
| // the source is constructed externally (e.g. TestSource for non-live pipeline | ||
| // testing, or ReplaySource for offline export). The source must have already | ||
| // populated the PipelineConfig with track information before calling this. | ||
| func NewWithSource(ctx context.Context, conf *config.PipelineConfig, src source.Source) (*Controller, error) { |
Contributor
There was a problem hiding this comment.
Can New be implemented, using NewWithSource? There is quite a bit of code duplication currently.
Contributor
Author
There was a problem hiding this comment.
yes - the only reason they got duplicated is because source creation needed controller callbacks for New - but if we apply inversion control that's no longer an issue and these could be compacted. Updated.
frostbyte73
approved these changes
Apr 20, 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.
This branch generalizes the gstreamer pipeline to support non-live sources (replay/export) in addition to the existing live capture flow. Historically the pipeline assumed every source produced data in real time, which baked several implicit behaviors into the build: leaky queues to shed overruns,
is-live=trueappsrc properties, an asynchronous file sink, and a singleNew()constructor that owned source creation. Those assumptions break down the moment a source pushes buffers faster than wall-clock, so the changes here rework the pipeline to be driven by an explicit Live flag onPipelineConfiginstead.The centerpiece is the new
Livebool field, set to true by default in both pipeline config constructors. The pre-existingIsReplayboolean is replaced with an IsReplay() method derived from!Live, which keeps replay-specific integration points (IPC calls into the service, storage access) working without conflating them with generic pipeline concerns like queue leakiness or backpressure.Downstream of that flag, audio and video bins now build blocking queues when Live is false so backpressure actually throttles the source, the appsrc elements toggle
is-liveto match the pipeline mode and addblock=truein non-live mode, and the file sink setsasync=falseto disable preroll for non-live runs — there's no real-time clock to sync against, so making the sink wait for PAUSED→PLAYING preroll-complete serves no purpose and just stalls the state transition . The previously namedbuildLeakyVideoQueueis renamed tobuildVideoQueueto reflect that leakiness is now a property of the mode, not the call site.On the output side, updateOutputs rejects stream outputs (RTMP, WebSocket) for non-live pipelines upfront, since those destinations cannot ingest faster than 1x playback speed and would otherwise fail deep inside the pipeline.
The controller is refactored to decouple source construction from pipeline construction. The existing
New()keeps its behavior, but the shared setup is extracted into newController() and a newNewWithSource()constructor accepts a pre-built source which is an interface, implementors might choose to build for different kind of sources.Original PR draft with test sources feeding data as fast as possible: #1182