oggmux: only clip by duration if end of buffer is ahead of segment

It might happen that the timestamp is before the segment and the
check would succeed. In this case reducing the duration makes no
sense and would lead to broken results.
This commit is contained in:
Thiago Santos 2014-12-26 18:55:08 -03:00
parent 8abfdd127f
commit 68fcf7ef52

View file

@ -871,7 +871,8 @@ gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
*/
end_time =
gst_ogg_stream_granule_to_time (&pad->map, pad->next_granule + duration);
if (!GST_CLOCK_TIME_IS_VALID (gst_segment_to_running_time (&pad->segment,
if (end_time > pad->segment.stop
&& !GST_CLOCK_TIME_IS_VALID (gst_segment_to_running_time (&pad->segment,
GST_FORMAT_TIME, end_time))) {
gint64 actual_duration =
gst_util_uint64_scale_round (pad->segment.stop - time,