]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_h263_rfc2190.c
rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
[ffmpeg] / libavformat / rtpdec_h263_rfc2190.c
index e45778108b1be549749b85e130ce3b2a1651c2ff..3a58aee22fe588e57fc61ee133d277f7d86acf9d 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "rtpdec_formats.h"
 #include "libavutil/attributes.h"
 #include "libavutil/intreadwrite.h"
@@ -39,13 +40,9 @@ struct PayloadContext {
     int          newformat;
 };
 
-static void h263_free_context(PayloadContext *data)
+static void h263_close_context(PayloadContext *data)
 {
-    if (data->buf) {
-        uint8_t *p;
-        avio_close_dyn_buf(data->buf, &p);
-        av_free(p);
-    }
+    ffio_free_dyn_buf(&data->buf);
 }
 
 static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
@@ -63,10 +60,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
 
     if (data->buf && data->timestamp != *timestamp) {
         /* Dropping old buffered, unfinished data */
-        uint8_t *p;
-        avio_close_dyn_buf(data->buf, &p);
-        av_free(p);
-        data->buf = NULL;
+        ffio_free_dyn_buf(&data->buf);
         data->endbyte_bits = 0;
     }
 
@@ -195,6 +189,6 @@ RTPDynamicProtocolHandler ff_h263_rfc2190_dynamic_handler = {
     .need_parsing      = AVSTREAM_PARSE_FULL,
     .parse_packet      = h263_handle_packet,
     .priv_data_size    = sizeof(PayloadContext),
-    .free              = h263_free_context,
+    .close             = h263_close_context,
     .static_payload_id = 34,
 };