summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2009-11-21 22:05:34 +0100
committerDavid Schleef <ds@schleef.org>2009-11-21 22:05:34 +0100
commitab0d8027814bc6874e66ec1035cd6740db2c39c4 (patch)
tree77c43755a8e5244e13ed5e2eeadb2255f6d0d97e
parent72edd1467bcb5040d1e89e782fc46059743e8646 (diff)
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.
-rw-r--r--ext/ogg/gstoggdemux.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index dd7c99daa..69cb986b7 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;