Commit 4c50ad0e authored by Michael Olbrich's avatar Michael Olbrich Committed by Sebastian Dröge

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;
parent b208ae72
......@@ -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,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment