From 1ef3722bf6328c3902e9d43c8000c368a3a30a25 Mon Sep 17 00:00:00 2001 From: Fabrizio Gennari Date: Fri, 21 Apr 2006 18:07:10 +0000 Subject: [PATCH] gst/avi/gstavidemux.c: When splitting audio chunks, the block alignment is not taken in consideration, so the smaller... Original commit message from CVS: Patch by: Fabrizio Gennari * gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream), (gst_avi_demux_parse_index), (gst_avi_demux_massage_index): When splitting audio chunks, the block alignment is not taken in consideration, so the smaller chunks could be of size which is not a multiple of the block alignment. Fixes #336904 --- ChangeLog | 10 ++++++++++ gst/avi/gstavidemux.c | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 219d301643..c5e4b3d5c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-04-21 Wim Taymans + + Patch by: Fabrizio Gennari + + * gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream), + (gst_avi_demux_parse_index), (gst_avi_demux_massage_index): + When splitting audio chunks, the block alignment is not taken in + consideration, so the smaller chunks could be of size which is + not a multiple of the block alignment. Fixes #336904 + 2006-04-21 Wim Taymans * ext/raw1394/gstdv1394src.c: (gst_dv1394src_convert): diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index c91f81453d..c6e6cc62e9 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -1914,11 +1914,18 @@ gst_avi_demux_massage_index (GstAviDemux * avi, * the allocation of index entries could be improved. */ stream = &avi->stream[entry->stream_nr]; if (entry->dur > MAX_DURATION && stream->strh->type == GST_RIFF_FCC_auds) { - guint32 ideal_size = stream->strf.auds->av_bps / 10; + guint32 ideal_size; gst_avi_index_entry *entries; gint old_size, num_added; GList *one2; + /* cut in 1/10th of a second */ + ideal_size = stream->strf.auds->av_bps / 10; + + /* ensure chunk size is multiple of blockalign */ + if (stream->strf.auds->blockalign > 1) + ideal_size -= ideal_size % stream->strf.auds->blockalign; + /* copy index */ old_size = entry->size; num_added = (entry->size - 1) / ideal_size;