rtpdec_vp8: Make sure the previous packet is returned
[ffmpeg.git] / libavformat / rtpdec_vp8.c
index 6dbf402..966f7b8 100644 (file)
@@ -233,12 +233,13 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
     vp8->prev_seq = seq;
     avio_write(vp8->data, buf, len);
 
+    if (returned_old_frame) {
+        *timestamp = old_timestamp;
+        return end_packet ? 1 : 0;
+    }
+
     if (end_packet) {
         int ret;
-        if (returned_old_frame) {
-            *timestamp = old_timestamp;
-            return 1;
-        }
         ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
         if (ret < 0)
             return ret;