diff mbox

[FFmpeg-devel] avformat/mux: ignore invalid timestamps on formats without timestamps

Message ID 20180412082038.12100-1-h.leppkes@gmail.com
State New
Headers show

Commit Message

Hendrik Leppkes April 12, 2018, 8:20 a.m. UTC
---
 libavformat/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer April 12, 2018, 7:59 p.m. UTC | #1
On Thu, Apr 12, 2018 at 10:20:38AM +0200, Hendrik Leppkes wrote:
> ---
>  libavformat/mux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

can you provide an example/testcase of when this is needed ?

thx

[...]
Hendrik Leppkes April 12, 2018, 8:24 p.m. UTC | #2
On Thu, Apr 12, 2018 at 9:59 PM, Michael Niedermayer
<michael@niedermayer.cc> wrote:
> On Thu, Apr 12, 2018 at 10:20:38AM +0200, Hendrik Leppkes wrote:
>> ---
>>  libavformat/mux.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> can you provide an example/testcase of when this is needed ?
>

Just take any file with that particular timestamp problem and try
muxing its audio into a raw audio formt, like .ac3. It already ignores
that error on non-strict timestamps, so it should even moreso ignore
it when not handling timestamps at all.

- Hendrik
diff mbox

Patch

diff --git a/libavformat/mux.c b/libavformat/mux.c
index a13f0e3a1b..0857419394 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -615,7 +615,7 @@  static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
     }
 
     if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
-        ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
+        ((!(s->oformat->flags & (AVFMT_TS_NONSTRICT|AVFMT_NOTIMESTAMPS)) &&
           st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE &&
           st->codecpar->codec_type != AVMEDIA_TYPE_DATA &&
           st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {