mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
scaletempo: Fix timestamp tracking
This commit is contained in:
parent
bb0c2d40c4
commit
7c136f1166
1 changed files with 11 additions and 4 deletions
|
@ -452,6 +452,7 @@ gst_scaletempo_transform (GstBaseTransform * trans,
|
|||
gint8 *pout;
|
||||
guint offset_in, bytes_out;
|
||||
GstMapInfo omap;
|
||||
GstClockTime timestamp;
|
||||
|
||||
gst_buffer_map (outbuf, &omap, GST_MAP_WRITE);
|
||||
pout = (gint8 *) omap.data;
|
||||
|
@ -487,11 +488,17 @@ gst_scaletempo_transform (GstBaseTransform * trans,
|
|||
|
||||
gst_buffer_unmap (outbuf, &omap);
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (inbuf) - p->segment_start;
|
||||
if (timestamp < p->latency)
|
||||
timestamp = 0;
|
||||
else
|
||||
timestamp -= p->latency;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = timestamp / p->scale + p->segment_start;
|
||||
GST_BUFFER_DURATION (outbuf) =
|
||||
gst_util_uint64_scale (bytes_out, GST_SECOND,
|
||||
p->bytes_per_frame * p->sample_rate);
|
||||
gst_buffer_set_size (outbuf, bytes_out);
|
||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||
(GST_BUFFER_TIMESTAMP (outbuf) - p->segment_start) / p->scale +
|
||||
p->segment_start;
|
||||
//GST_BUFFER_DURATION (outbuf) = bytes_out * GST_SECOND / (p->bytes_per_frame * p->sample_rate);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue