avformat/mov: Skip non-key frames if AVDISCARD_NONKEY is set.
authorVadim Kalinsky <vadim@kalinsky.ru>
Tue, 28 Jun 2016 18:09:46 +0000 (14:09 -0400)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Jun 2016 10:00:13 +0000 (12:00 +0200)
Github: Closes #222

libavformat/mov.c

index a929f74..485bb0b 100644 (file)
@@ -5224,6 +5224,12 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
             sc->current_sample -= should_retry(sc->pb, ret64);
             return AVERROR_INVALIDDATA;
         }
+
+        if( st->discard == AVDISCARD_NONKEY && 0==(sample->flags & AVINDEX_KEYFRAME) ) {
+            av_log(mov->fc, AV_LOG_DEBUG, "Nonkey frame from stream %d discarded due to AVDISCARD_NONKEY\n", sc->ffindex);
+            goto retry;
+        }
+
         ret = av_get_packet(sc->pb, pkt, sample->size);
         if (ret < 0) {
             sc->current_sample -= should_retry(sc->pb, ret);