mpegts_write_pes() warns when DTS - PCR is negative. This is
done to detect frames that are late for decoding, meaning that
timestamping is wrong or the muxrate value is insufficient.

But this comparison only makes sense on the first packet of
the frame. After that the comparison will always be negative
as DTS doesn't change until the next frame, resulting in
hundreds of useless warnings.

Addtionaly, for long key frames that take several frame periods
to transmity false warnings may be issued if max_delay
is low enough. For example, in low latency CC video.

Limiting the warning to the start of frame transmission fixes
these issues.

Signed-off-by: David Dominguez <[email protected]>
---
 libavformat/mpegtsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 6935b71cfe..d66055e1dc 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1596,7 +1596,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream 
*st,
             set_af_flag(buf, 0x10);
             q = get_ts_payload_start(buf);
             // add 11, pcr references the last byte of program clock reference 
base
-            if (dts != AV_NOPTS_VALUE && dts < pcr / 
SYSTEM_CLOCK_FREQUENCY_DIVISOR)
+            if (is_start && dts != AV_NOPTS_VALUE && dts < pcr / 
SYSTEM_CLOCK_FREQUENCY_DIVISOR)
                 av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n");
             extend_af(buf, write_pcr_bits(q, pcr));
             q = get_ts_payload_start(buf);
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to