qtmux: handle 0 size packets without dividing by 0

Coverity 1139691
This commit is contained in:
Vincent Penquerc'h 2014-05-02 10:21:09 +01:00
parent b692539b55
commit 1be86ebb2a

View file

@ -2387,7 +2387,10 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
} else {
nsamples = gst_buffer_get_size (last_buf) / sample_size;
}
duration = GST_BUFFER_DURATION (last_buf) / nsamples;
if (nsamples > 0)
duration = GST_BUFFER_DURATION (last_buf) / nsamples;
else
duration = 0;
/* timescale = samplerate */
scaled_duration = 1;