]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_vp8.c
audiodsp/x86: clear the high bits of the order parameter on 64bit
[ffmpeg] / libavformat / rtpdec_vp8.c
index 9fa5afa6299d0af35d1f7ed15c5730c6fb6917b1..b7f9939d05436b430ded941ae763b5aafbb069d1 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "libavcodec/bytestream.h"
 
+#include "avio_internal.h"
 #include "rtpdec_formats.h"
 
 struct PayloadContext {
@@ -45,29 +46,19 @@ struct PayloadContext {
     int          prev_pictureid;
     int          broken_frame;
     /* If sequence_dirty is set, we have lost some data (critical or
-     * non-critical) and decoding will have some sort of artefacts, and
+     * non-critical) and decoding will have some sort of artifacts, and
      * we thus should request a new keyframe.
      */
     int          sequence_dirty;
     int          got_keyframe;
 };
 
-static void vp8_free_buffer(PayloadContext *vp8)
-{
-    uint8_t *tmp;
-    if (!vp8->data)
-        return;
-    avio_close_dyn_buf(vp8->data, &tmp);
-    av_free(tmp);
-    vp8->data = NULL;
-}
-
 static int vp8_broken_sequence(AVFormatContext *ctx, PayloadContext *vp8,
                                const char *msg)
 {
     vp8->sequence_ok = 0;
     av_log(ctx, AV_LOG_WARNING, "%s", msg);
-    vp8_free_buffer(vp8);
+    ffio_free_dyn_buf(&vp8->data);
     return AVERROR(EAGAIN);
 }
 
@@ -150,7 +141,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
         int res;
         int non_key = buf[0] & 0x01;
         if (!non_key) {
-            vp8_free_buffer(vp8);
+            ffio_free_dyn_buf(&vp8->data);
             // Keyframe, decoding ok again
             vp8->sequence_ok = 1;
             vp8->sequence_dirty = 0;
@@ -205,7 +196,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
                     old_timestamp = vp8->timestamp;
                 } else {
                     // Shouldn't happen
-                    vp8_free_buffer(vp8);
+                    ffio_free_dyn_buf(&vp8->data);
                 }
             }
         }
@@ -275,9 +266,9 @@ static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp
     return 0;
 }
 
-static void vp8_free_context(PayloadContext *vp8)
+static void vp8_close_context(PayloadContext *vp8)
 {
-    vp8_free_buffer(vp8);
+    ffio_free_dyn_buf(&vp8->data);
 }
 
 static int vp8_need_keyframe(PayloadContext *vp8)
@@ -291,7 +282,7 @@ RTPDynamicProtocolHandler ff_vp8_dynamic_handler = {
     .codec_id       = AV_CODEC_ID_VP8,
     .priv_data_size = sizeof(PayloadContext),
     .init           = vp8_init,
-    .free           = vp8_free_context,
+    .close          = vp8_close_context,
     .parse_packet   = vp8_handle_packet,
     .need_keyframe  = vp8_need_keyframe,
 };