audiorate: Fix buffer offset_end when within tolerance.

This fixes issues if we then have downstream elements that operate
on offset/offset_end.

And add the expected timestamp in the debug logs
This commit is contained in:
Edward Hervey 2010-05-26 08:51:09 +02:00
parent fdfb70e262
commit 514a34b255

View file

@ -552,10 +552,11 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
GST_LOG_OBJECT (audiorate, GST_LOG_OBJECT (audiorate,
"in_time:%" GST_TIME_FORMAT ", in_duration:%" GST_TIME_FORMAT "in_time:%" GST_TIME_FORMAT ", in_duration:%" GST_TIME_FORMAT
", in_size:%u, in_offset:%" G_GUINT64_FORMAT ", in_offset_end:%" ", in_size:%u, in_offset:%" G_GUINT64_FORMAT ", in_offset_end:%"
G_GUINT64_FORMAT ", ->next_offset:%" G_GUINT64_FORMAT, G_GUINT64_FORMAT ", ->next_offset:%" G_GUINT64_FORMAT ", ->next_ts:%"
GST_TIME_ARGS (in_time), GST_TIME_FORMAT, GST_TIME_ARGS (in_time),
GST_TIME_ARGS (GST_FRAMES_TO_CLOCK_TIME (in_samples, audiorate->rate)), GST_TIME_ARGS (GST_FRAMES_TO_CLOCK_TIME (in_samples, audiorate->rate)),
in_size, in_offset, in_offset_end, audiorate->next_offset); in_size, in_offset, in_offset_end, audiorate->next_offset,
GST_TIME_ARGS (audiorate->next_ts));
diff = in_time - audiorate->next_ts; diff = in_time - audiorate->next_ts;
if (diff <= (GstClockTimeDiff) audiorate->tolerance && if (diff <= (GstClockTimeDiff) audiorate->tolerance &&
@ -565,6 +566,9 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
* it to next ts and offset and sending */ * it to next ts and offset and sending */
GST_LOG_OBJECT (audiorate, "within tolerance %" GST_TIME_FORMAT, GST_LOG_OBJECT (audiorate, "within tolerance %" GST_TIME_FORMAT,
GST_TIME_ARGS (audiorate->tolerance)); GST_TIME_ARGS (audiorate->tolerance));
/* The outgoing buffer's offset will be set to ->next_offset, we also
* need to adjust the offset_end value accordingly */
in_offset_end = audiorate->next_offset + in_samples;
goto send; goto send;
} }