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
This commit is contained in:
Michael Olbrich 2015-11-18 16:10:11 +01:00 committed by Sebastian Dröge
parent b208ae72ee
commit 4c50ad0e27

View file

@ -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,