diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-10-23 14:32:24 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-10-23 14:32:24 +0200 |
commit | 7c136f116629f1b70bdd7abe484d4590fcee11e3 (patch) | |
tree | e5771217ff1dd7588c0d237f84b2a301deb396ee /gst | |
parent | bb0c2d40c48e526339789758f9862f3c4f54c97b (diff) |
scaletempo: Fix timestamp tracking
Diffstat (limited to 'gst')
-rw-r--r-- | gst/scaletempo/gstscaletempo.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gst/scaletempo/gstscaletempo.c b/gst/scaletempo/gstscaletempo.c index 8312335a3..f2a5240f3 100644 --- a/gst/scaletempo/gstscaletempo.c +++ b/gst/scaletempo/gstscaletempo.c @@ -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; } |