From fa75ae96e1b2bc0d689a957d4c522002965c4eb2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 29 May 2013 14:54:44 +0200 Subject: [PATCH] demux_asf: fix after commit 5165e19 This demuxer reallocated packets on its own, instead of using the demux.c functions, which clashed with a recent change. --- demux/demux.c | 3 +-- demux/demux_asf.c | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index c379ee4736..856951f905 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -742,8 +742,7 @@ void ds_free_packs(demux_stream_t *ds) } if (ds->asf_packet) { // free unfinished .asf fragments: - free(ds->asf_packet->buffer); - free(ds->asf_packet); + free_demux_packet(ds->asf_packet); ds->asf_packet = NULL; } ds->first = ds->last = NULL; diff --git a/demux/demux_asf.c b/demux/demux_asf.c index 1d181eac67..0b8da6930f 100644 --- a/demux/demux_asf.c +++ b/demux/demux_asf.c @@ -100,11 +100,9 @@ static void init_priv (struct asf_priv* asf){ static void demux_asf_append_to_packet(demux_packet_t* dp,unsigned char *data,int len,int offs) { if(dp->len!=offs && offs!=-1) mp_msg(MSGT_DEMUX,MSGL_V,"warning! fragment.len=%d BUT next fragment offset=%d \n",dp->len,offs); - dp->buffer=realloc(dp->buffer,dp->len+len+MP_INPUT_BUFFER_PADDING_SIZE); - memcpy(dp->buffer+dp->len,data,len); - memset(dp->buffer+dp->len+len, 0, MP_INPUT_BUFFER_PADDING_SIZE); - mp_dbg(MSGT_DEMUX,MSGL_DBG4,"data appended! %d+%d\n",dp->len,len); - dp->len+=len; + size_t old_len = dp->len; + resize_demux_packet(dp, dp->len + len); + memcpy(dp->buffer + old_len, data, len); } static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,int id,int seq,uint64_t time,unsigned short dur,int offs,int keyframe){