diff mbox

[FFmpeg-devel] movenc: take packet dts shifting into mention in check_pkt

Message ID 20170929220400.28352-1-jeebjp@gmail.com
State Accepted
Commit ffc58b2ce27e140b47900d1ead304663f7b385ae
Headers show

Commit Message

Jan Ekström Sept. 29, 2017, 10:04 p.m. UTC
This FFmpeg-specific "fuzzer fix" was never perfect, but now it
stopped encoding of actual content with a big enough DTS shift.
This returns the function to its original state of results
before negative CTS offsets were added.

I remember dealing with this function before, but somehow had
forgotten about it during VDD. The test cases not tripping this
over also didn't help.
---
 libavformat/movenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Niedermayer Sept. 30, 2017, 1:07 a.m. UTC | #1
On Sat, Sep 30, 2017 at 01:04:00AM +0300, Jan Ekström wrote:
> This FFmpeg-specific "fuzzer fix" was never perfect, but now it
> stopped encoding of actual content with a big enough DTS shift.
> This returns the function to its original state of results
> before negative CTS offsets were added.
> 
> I remember dealing with this function before, but somehow had
> forgotten about it during VDD. The test cases not tripping this
> over also didn't help.
> ---
>  libavformat/movenc.c | 6 ++++++
>  1 file changed, 6 insertions(+)

makes sense

thx
diff mbox

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 9c3e6437d7..2838286141 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4989,6 +4989,12 @@  static int check_pkt(AVFormatContext *s, AVPacket *pkt)
     } else
         ref = pkt->dts; // Skip tests for the first packet
 
+    if (trk->dts_shift != AV_NOPTS_VALUE) {
+        /* With negative CTS offsets we have set an offset to the DTS,
+         * reverse this for the check. */
+        ref -= trk->dts_shift;
+    }
+
     duration = pkt->dts - ref;
     if (pkt->dts < ref || duration >= INT_MAX) {
         av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n",