Merge commit '152b797cd687e96a582a1cb908dddf3d330d7637'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 24 Apr 2014 19:49:02 +0000 (21:49 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 24 Apr 2014 19:50:28 +0000 (21:50 +0200)
* commit '152b797cd687e96a582a1cb908dddf3d330d7637':
  flv: Do not mangle dts values for negative cts

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/flvdec.c

@@@ -934,24 -896,15 +934,22 @@@ retry_duration
              // sign extension
              int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;
              pts = dts + cts;
 -            if (cts < 0 && !flv->wrong_dts) { // dts might be wrong
 +            if (cts < 0) { // dts might be wrong
 +                if (!flv->wrong_dts)
 +                    av_log(s, AV_LOG_WARNING,
 +                        "Negative cts, previous timestamps might be wrong.\n");
                  flv->wrong_dts = 1;
 +            } else if (FFABS(dts - pts) > 1000*60*15) {
                  av_log(s, AV_LOG_WARNING,
 -                       "Negative cts, previous timestamps might be wrong.\n");
 +                       "invalid timestamps %"PRId64" %"PRId64"\n", dts, pts);
 +                dts = pts = AV_NOPTS_VALUE;
              }
-             if (flv->wrong_dts)
-                 dts = AV_NOPTS_VALUE;
          }
 -        if (type == 0) {
 +        if (type == 0 && (!st->codec->extradata || st->codec->codec_id == AV_CODEC_ID_AAC)) {
 +            AVDictionaryEntry *t;
 +
              if (st->codec->extradata) {
 -                if ((ret = flv_queue_extradata(flv, s->pb, is_audio, size)) < 0)
 +                if ((ret = flv_queue_extradata(flv, s->pb, stream_type, size)) < 0)
                      return ret;
                  ret = AVERROR(EAGAIN);
                  goto leave;