mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Compensate for timestamp/duration rounding errors
This commit is contained in:
parent
a930b36adc
commit
dfa0e43848
2 changed files with 13 additions and 0 deletions
|
@ -1534,6 +1534,18 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
|
||||||
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET_NONE;
|
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET_NONE;
|
||||||
GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET_NONE;
|
GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET_NONE;
|
||||||
|
|
||||||
|
/* Update accumulated error and compensate */
|
||||||
|
{
|
||||||
|
guint64 abs_error = (GST_SECOND * pad->material_track->edit_rate.d) %
|
||||||
|
pad->material_track->edit_rate.n;
|
||||||
|
pad->last_stop_accumulated_error +=
|
||||||
|
((gdouble) abs_error) / ((gdouble) pad->material_track->edit_rate.n);
|
||||||
|
}
|
||||||
|
if (pad->last_stop_accumulated_error >= 1.0) {
|
||||||
|
GST_BUFFER_DURATION (outbuf) += 1;
|
||||||
|
pad->last_stop_accumulated_error -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
if (pad->need_segment) {
|
if (pad->need_segment) {
|
||||||
gst_pad_push_event (GST_PAD_CAST (pad),
|
gst_pad_push_event (GST_PAD_CAST (pad),
|
||||||
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1,
|
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1,
|
||||||
|
|
|
@ -93,6 +93,7 @@ struct _GstMXFDemuxPad
|
||||||
gboolean need_segment;
|
gboolean need_segment;
|
||||||
|
|
||||||
GstClockTime last_stop;
|
GstClockTime last_stop;
|
||||||
|
gdouble last_stop_accumulated_error;
|
||||||
GstFlowReturn last_flow;
|
GstFlowReturn last_flow;
|
||||||
gboolean eos, discont;
|
gboolean eos, discont;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue