From ab0d8027814bc6874e66ec1035cd6740db2c39c4 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 21 Nov 2009 22:05:34 +0100 Subject: [PATCH] ogg: Fix generation of timestamps and durations After changing some internal functions, I forgot to update the code that puts the values on the buffers. --- ext/ogg/gstoggdemux.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index dd7c99daab..69cb986b7c 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -460,6 +460,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet) GstOggDemux *ogg = pad->ogg; gint64 current_time; GstOggChain *chain; + gint64 duration; GST_DEBUG_OBJECT (ogg, "%p streaming to peer serial %08x", pad, pad->map.serialno); @@ -476,10 +477,14 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet) /* copy packet in buffer */ memcpy (buf->data, packet->packet, packet->bytes); - GST_BUFFER_TIMESTAMP (buf) = gst_ogg_stream_get_packet_start_time (&pad->map, - packet); - GST_BUFFER_DURATION (buf) = gst_ogg_stream_get_packet_duration (&pad->map, - packet); + duration = gst_ogg_stream_get_packet_duration (&pad->map, packet); + + GST_BUFFER_TIMESTAMP (buf) = gst_ogg_stream_granule_to_time (&pad->map, + pad->current_granule); + pad->current_granule += duration; + GST_BUFFER_DURATION (buf) = gst_ogg_stream_granule_to_time (&pad->map, + pad->current_granule) - GST_BUFFER_TIMESTAMP (buf); + GST_BUFFER_OFFSET (buf) = -1; GST_BUFFER_OFFSET_END (buf) = packet->granulepos;