Skip to content

Commit

Permalink
bug(h264/h265): DTS may stay the same (#119)
Browse files Browse the repository at this point in the history
Foe some reason in the code the monotonical increasing
did forbid having the same value as before, while
purely mathematical definition of a "monotonical increasing"
does allow to have the same value. Fixing it.

ITS: bluenviron/mediamtx#1002

Signed-off-by: Dmitrii Okunev <xaionaro@dx.center>
  • Loading branch information
xaionaro authored May 16, 2024
1 parent 4c06e8f commit 67170fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/codecs/h264/dts_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (d *DTSExtractor) Extract(au [][]byte, pts time.Duration) (time.Duration, e
return 0, fmt.Errorf("DTS is greater than PTS")
}

if d.prevDTSFilled && dts <= d.prevDTS {
if d.prevDTSFilled && dts < d.prevDTS {
return 0, fmt.Errorf("DTS is not monotonically increasing, was %v, now is %v",
d.prevDTS, dts)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/h265/dts_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (d *DTSExtractor) Extract(au [][]byte, pts time.Duration) (time.Duration, e
return 0, fmt.Errorf("DTS is greater than PTS")
}

if d.prevDTSFilled && dts <= d.prevDTS {
if d.prevDTSFilled && dts < d.prevDTS {
return 0, fmt.Errorf("DTS is not monotonically increasing, was %v, now is %v",
d.prevDTS, dts)
}
Expand Down

0 comments on commit 67170fc

Please sign in to comment.