copy_raw mode for bypassing fragmented mp4 creation#151
Merged
lukseven merged 10 commits intodev-live-feedsfrom Feb 16, 2026
Merged
copy_raw mode for bypassing fragmented mp4 creation#151lukseven merged 10 commits intodev-live-feedsfrom
copy_raw mode for bypassing fragmented mp4 creation#151lukseven merged 10 commits intodev-live-feedsfrom
Conversation
* use bypass processor if `raw_only` is specified on the stream independent of the `bypass_libav_reader` setting * ensure BypassProcessor.Status/Cancel/Wait don't panic if called before Start() * ensure net reader is canceled even if blocked on reading from network (by closing the socket) * comment typo
There was a problem hiding this comment.
Pull request overview
This PR adds a new MPEGTS “bypass” mode (copy_mode=raw_only) that copies incoming MPEGTS directly into parts without invoking ffmpeg/libav, along with related lifecycle wiring, stats/reporting updates, and NetReader cancellation improvements.
Changes:
- Introduces a
BypassProcessorabstraction and an MPEGTS implementation to copy streams directly to segmented outputs. - Integrates bypass initialization/run/cancel into
XcInit/XcRun/XcCancelusing negative handles. - Adds “first packet received” reporting (
AV_IN_STAT_MPEGTS_START) and improves NetReader cancellation behavior and tests.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| goavpipe/structs.go | Adds CopyModeRawOnly, new stat type, JSON tags/default tweaks for input processor config. |
| goavpipe/handlers.go | Adds BypassProcessor interface and global bypass-processor handle management. |
| broadcastproto/mpegts/bypass.go | New bypass processor implementation built on NetReader + MPEGTS packet processing. |
| broadcastproto/mpegts/netreader.go | Improves cancellation by tracking/closing the active reader and honoring ctx cancellation in connect loop. |
| broadcastproto/mpegts/netreader_test.go | Adds a cancellation test scenario with no incoming packets. |
| broadcastproto/mpegts/mpegts.go | Adds ReportStart() plumbing and logs fd with stats output. |
| broadcastproto/mpegts/custom.go | Adds onFirstPacket callback to trigger start reporting on first packet. |
| avpipe_seq_writer.go | Implements ReportStart() for sequential MPEGTS output handler. |
| avpipe.go | Adds bypass mode selection in XcInit and bypass execution/cancel paths in XcRun/XcCancel; refactors AVPipeOpenInput via AVPipeOpenInputGo. |
| go.mod | Adds github.com/gammazero/deque as an indirect dependency. |
| go.sum | Adds checksums for github.com/gammazero/deque. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
elv-serban
approved these changes
Feb 11, 2026
Contributor
|
Tried to fix misspelled branch name... |
…processor # Conflicts: # go.mod # go.sum
copy_raw mode for bypassing fragmented mp4 creation
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 pull request introduces a new "bypass" processing mode for MPEGTS streams, allowing AVPipe to copy streams directly into parts without using ffmpeg/libav. The most significant changes include the implementation of the
BypassProcessorinterface and its integration into the AVPipe initialization and run/cancel flows, modifications to reporting and stats handling for MPEGTS streams, and improvements to the NetReader's cancellation and recovery logic.The use of the bypass processor is configurable per live stream, and enabled by setting
/live_recording/recording_config/recording_params/xc_params/input_cfg/copy_mode=raw_onlyBypass processing and integration:
BypassProcessorinterface and implemented it inbroadcastproto/mpegts/bypass.go, enabling direct stream copying whenCopyModeRawOnlyis selected. This processor is managed with negative handles to distinguish it from regular ffmpeg-based processors. [1] [2] [3]XcInit,XcRun, andXcCancelinavpipe.go, including handle assignment, processor startup, cancellation, and cleanup. [1] [2] [3] [4]MPEGTS stats and reporting enhancements:
ReportStartmethod toSequentialOpenerandMpegtsPacketProcessor, allowing reporting when the first packet is received. This is triggered via a newonFirstPacketcallback inMpegTsConsumer. [1] [2] [3] [4] [5]AV_IN_STAT_MPEGTS_STARTstat type and corresponding string name for improved event tracking. [1] [2]NetReader improvements:
NetReaderto close the underlying reader safely and to handle context cancellation during connection attempts. [1] [2] [3] [4]Configuration and global management:
CopyModewithCopyModeRawOnlyand clarifiedInputConfighandling for processor selection. [1] [2][1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22]