From 4c50ad0e27bfc431541897507c2bc6b90080aac7 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 18 Nov 2015 16:10:11 +0100 Subject: [PATCH] avimux: don't crash if we never got audio caps before stopping auds.blockalign is set once the first caps arrive. If gst_avi_mux_stop_file() is called before this happens then auds.blockalign is zero and gst_avi_mux_audsink_set_fields() cause a crash: [...] avipad->parent.hdr.rate = avipad->auds.av_bps / avipad->auds.blockalign; [...] https://bugzilla.gnome.org/show_bug.cgi?id=758912 --- gst/avi/gstavimux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index 2ef3d3e..ddfac13 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -1824,6 +1824,8 @@ gst_avi_mux_stop_file (GstAviMux * avimux) /* housekeeping for vbr case */ if (audpad->max_audio_chunk) audpad->auds.blockalign = audpad->max_audio_chunk; + if (audpad->auds.blockalign == 0) + audpad->auds.blockalign = 1; gst_avi_mux_audsink_set_fields (avimux, audpad); avimux->avi_hdr.max_bps += audpad->auds.av_bps; avipad->hdr.length = gst_util_uint64_scale (audpad->audio_time, -- 2.7.4