faad: correctly estimate average bps

Count consumed bytes and corresponding duration atomically,
rather than letting bytecount run ahead of what has been decoded.

Fixes #440476.
This commit is contained in:
Mark Nauwelaerts 2010-02-10 22:14:07 +01:00
parent 2230469113
commit f6ea217792

View file

@ -1002,10 +1002,6 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
faad->discont = TRUE;
}
GST_OBJECT_LOCK (faad);
faad->bytes_in += GST_BUFFER_SIZE (buffer);
GST_OBJECT_UNLOCK (faad);
gst_adapter_push (faad->adapter, buffer);
buffer = NULL;
@ -1151,6 +1147,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
GST_OBJECT_LOCK (faad);
faad->next_ts += GST_BUFFER_DURATION (outbuf);
faad->sum_dur_out += GST_BUFFER_DURATION (outbuf);
faad->bytes_in += info.bytesconsumed;
GST_OBJECT_UNLOCK (faad);
if ((outbuf = gst_audio_buffer_clip (outbuf, &faad->segment,