Skip to content

fix: handle DTS discontinuity by resetting extractor on error - #5896

Open
keks2293 wants to merge 1 commit into
bluenviron:mainfrom
keks2293:fix/dts-error-recovery
Open

fix: handle DTS discontinuity by resetting extractor on error#5896
keks2293 wants to merge 1 commit into
bluenviron:mainfrom
keks2293:fix/dts-error-recovery

Conversation

@keks2293

Copy link
Copy Markdown

fix: recover from DTS extractor error instead of killing the stream

Problem

When DTSExtractor.Extract() returns an error (e.g., non-monotonic DTS on camera
reconnect, stream discontinuity, or DTS > PTS), mediamtx returns the error which
terminates the entire stream.

This happens frequently with IP cameras that lose signal and reconnect, resetting
their DTS to 0. The stream is killed for a temporary condition.

Fix

Instead of propagating the error, reset the DTS extractor to nil and drop the frame.
The extractor will be recreated on the next IDR/random access frame, and the stream
continues normally.

Rationale

  • killing the stream on a temporary DTS discontinuity is worse than dropping a single frame
  • FFmpeg and GStreamer handle discontinuities the same way: reset timing baseline, continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant