]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_vp8.c
Merge commit '55aa03b9f8f11ebb7535424cc0e5635558590f49'
[ffmpeg] / libavformat / rtpdec_vp8.c
index 96a1a3407e6252fa6a0f1ad4271b0bb0399f0e3b..623d3599f51486cd114747a62ced3948a554af34 100644 (file)
@@ -3,20 +3,20 @@
  * Copyright (c) 2010 Josh Allmann
  * Copyright (c) 2012 Martin Storsjo
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -90,6 +90,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
             if (ret < 0)
                 return ret;
             *timestamp = vp8->timestamp;
+            if (vp8->sequence_dirty)
+                pkt->flags |= AV_PKT_FLAG_CORRUPT;
             return 0;
         }
         return AVERROR(EAGAIN);
@@ -198,7 +200,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
                     int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
                     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 {
@@ -222,11 +224,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
 
         if (vp8->timestamp != *timestamp) {
             // Missed the start of the new frame, sequence broken
-            vp8->sequence_ok = 0;
-            av_log(ctx, AV_LOG_WARNING,
-                   "Received no start marker; dropping frame\n");
-            vp8_free_buffer(vp8);
-            return AVERROR(EAGAIN);
+            return vp8_broken_sequence(ctx, vp8,
+                                       "Received no start marker; dropping frame\n");
         }
 
         if (seq != expected_seq) {
@@ -247,7 +246,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
         return vp8_broken_sequence(ctx, vp8, "Received no start marker\n");
 
     vp8->prev_seq = seq;
-    avio_write(vp8->data, buf, len);
+    if (!vp8->broken_frame)
+        avio_write(vp8->data, buf, len);
 
     if (returned_old_frame) {
         *timestamp = old_timestamp;
@@ -259,8 +259,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
         ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
         if (ret < 0)
             return ret;
-        if (vp8->broken_frame)
-            pkt->size = vp8->first_part_size;
+        if (vp8->sequence_dirty)
+            pkt->flags |= AV_PKT_FLAG_CORRUPT;
         return 0;
     }