From a24c3afade15911fbf3a06b24c39fa53a1d6642e Mon Sep 17 00:00:00 2001 From: Dmitrii Okunev Date: Mon, 22 Apr 2024 22:49:33 +0100 Subject: [PATCH] bug(h264/h265): DTS may stay the same 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: https://github.com/bluenviron/mediamtx/issues/1002 Signed-off-by: Dmitrii Okunev --- pkg/codecs/h264/dts_extractor.go | 2 +- pkg/codecs/h265/dts_extractor.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/codecs/h264/dts_extractor.go b/pkg/codecs/h264/dts_extractor.go index 4042e89..82e04a6 100644 --- a/pkg/codecs/h264/dts_extractor.go +++ b/pkg/codecs/h264/dts_extractor.go @@ -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) } diff --git a/pkg/codecs/h265/dts_extractor.go b/pkg/codecs/h265/dts_extractor.go index 70cd756..eb967b1 100644 --- a/pkg/codecs/h265/dts_extractor.go +++ b/pkg/codecs/h265/dts_extractor.go @@ -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) }