X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Frtpdec_asf.c;h=019123e55941085f3cc7937a0e99bb110584b9d2;hb=c95c039ec38877e783b97c1a83c3b9d6ee6d03e6;hp=44c0a243bd06e4f12d52125c29a429f16183380d;hpb=f56f0e091fbd8a6c917f02c291628717497276fc;p=ffmpeg diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 44c0a243bd0..019123e5594 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -224,10 +224,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, * multiple RTP packets. */ if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) { - uint8_t *p; - avio_close_dyn_buf(asf->pktbuf, &p); - asf->pktbuf = NULL; - av_free(p); + ffio_free_dyn_buf(&asf->pktbuf); } if (!len_off && !asf->pktbuf && (res = avio_open_dyn_buf(&asf->pktbuf)) < 0) @@ -288,19 +285,9 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, return res == 1 ? -1 : res; } -static PayloadContext *asfrtp_new_context(void) +static void asfrtp_close_context(PayloadContext *asf) { - return av_mallocz(sizeof(PayloadContext)); -} - -static void asfrtp_free_context(PayloadContext *asf) -{ - if (asf->pktbuf) { - uint8_t *p = NULL; - avio_close_dyn_buf(asf->pktbuf, &p); - asf->pktbuf = NULL; - av_free(p); - } + ffio_free_dyn_buf(&asf->pktbuf); av_freep(&asf->buf); av_free(asf); } @@ -310,9 +297,9 @@ RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \ .enc_name = s, \ .codec_type = t, \ .codec_id = AV_CODEC_ID_NONE, \ + .priv_data_size = sizeof(PayloadContext), \ .parse_sdp_a_line = asfrtp_parse_sdp_line, \ - .alloc = asfrtp_new_context, \ - .free = asfrtp_free_context, \ + .close = asfrtp_close_context, \ .parse_packet = asfrtp_parse_packet, \ }