]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_xiph.c
avisynth: Bump minimum required version to interface version 6
[ffmpeg] / libavformat / rtpdec_xiph.c
index 5d0dc69dc21c194b460c3013848661f08b588c7f..66e619149b2e4592ca1dc0d099de7c97725d6ec1 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <assert.h>
 
+#include "avio_internal.h"
 #include "rtpdec.h"
 #include "rtpdec_formats.h"
 
@@ -49,19 +50,9 @@ struct PayloadContext {
     int split_pkts;
 };
 
-static void free_fragment(PayloadContext * data)
+static void xiph_close_context(PayloadContext * data)
 {
-    if (data->fragment) {
-        uint8_t* p;
-        avio_close_dyn_buf(data->fragment, &p);
-        av_free(p);
-        data->fragment = NULL;
-    }
-}
-
-static void xiph_free_context(PayloadContext * data)
-{
-    free_fragment(data);
+    ffio_free_dyn_buf(&data->fragment);
     av_free(data->split_buf);
 }
 
@@ -168,7 +159,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
         int res;
 
         // end packet has been lost somewhere, so drop buffered data
-        free_fragment(data);
+        ffio_free_dyn_buf(&data->fragment);
 
         if((res = avio_open_dyn_buf(&data->fragment)) < 0)
             return res;
@@ -181,7 +172,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
         if (data->timestamp != *timestamp) {
             // skip if fragmented timestamp is incorrect;
             // a start packet has been lost somewhere
-            free_fragment(data);
+            ffio_free_dyn_buf(&data->fragment);
             av_log(ctx, AV_LOG_ERROR, "RTP timestamps don't match!\n");
             return AVERROR_INVALIDDATA;
         }
@@ -381,7 +372,7 @@ RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
     .codec_id         = AV_CODEC_ID_THEORA,
     .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = xiph_parse_sdp_line,
-    .free             = xiph_free_context,
+    .close            = xiph_close_context,
     .parse_packet     = xiph_handle_packet,
 };
 
@@ -392,6 +383,6 @@ RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = {
     .need_parsing     = AVSTREAM_PARSE_HEADERS,
     .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = xiph_parse_sdp_line,
-    .free             = xiph_free_context,
+    .close            = xiph_close_context,
     .parse_packet     = xiph_handle_packet,
 };