rtpdec_vp8: Mark broken packets with AV_PKT_FLAG_CORRUPT
authorMartin Storsjö <martin@martin.st>
Tue, 8 Jan 2013 21:21:15 +0000 (23:21 +0200)
committerMartin Storsjö <martin@martin.st>
Wed, 9 Jan 2013 10:14:00 +0000 (12:14 +0200)
This allows the caller to either include them (and get more packets
decoded, but possibly some nonperfect frames), or discard them (by
setting fflags=discardcorrupt).

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtpdec_vp8.c

index 96a1a3407e6252fa6a0f1ad4271b0bb0399f0e3b..c1bffaac0dd7c64b460e06a0a2e11aaa67123ec7 100644 (file)
@@ -90,6 +90,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
             if (ret < 0)
                 return ret;
             *timestamp = vp8->timestamp;
             if (ret < 0)
                 return ret;
             *timestamp = vp8->timestamp;
+            if (vp8->sequence_dirty)
+                pkt->flags |= AV_PKT_FLAG_CORRUPT;
             return 0;
         }
         return AVERROR(EAGAIN);
             return 0;
         }
         return AVERROR(EAGAIN);
@@ -199,6 +201,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
                     if (ret < 0)
                         return ret;
                     pkt->size = vp8->first_part_size;
                     if (ret < 0)
                         return ret;
                     pkt->size = vp8->first_part_size;
+                    pkt->flags |= AV_PKT_FLAG_CORRUPT;
                     returned_old_frame = 1;
                     old_timestamp = vp8->timestamp;
                 } else {
                     returned_old_frame = 1;
                     old_timestamp = vp8->timestamp;
                 } else {
@@ -261,6 +264,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
             return ret;
         if (vp8->broken_frame)
             pkt->size = vp8->first_part_size;
             return ret;
         if (vp8->broken_frame)
             pkt->size = vp8->first_part_size;
+        if (vp8->sequence_dirty)
+            pkt->flags |= AV_PKT_FLAG_CORRUPT;
         return 0;
     }
 
         return 0;
     }