diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-12-21 13:37:41 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-12-21 13:39:27 +0100 |
commit | 1dafd7136d4f365d9ff91b4d18a62e072481a704 (patch) | |
tree | 2aa8ff047e0cfec903507cd715f6a63db4c59b3d | |
parent | eac243bc01100c73c4d8b3ec62464a4533fc9469 (diff) |
vorbisdec: keep timestamps when no decoded output
Keep track of the timestamps even when we didn't generate decodable output.
-rw-r--r-- | ext/vorbis/gstvorbisdec.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ext/vorbis/gstvorbisdec.c b/ext/vorbis/gstvorbisdec.c index e607ce1d9..33f4184d5 100644 --- a/ext/vorbis/gstvorbisdec.c +++ b/ext/vorbis/gstvorbisdec.c @@ -840,8 +840,15 @@ vorbis_do_timestamps (GstVorbisDec * vd, GstBuffer * buf, gboolean reverse, if (vd->last_timestamp != -1 && duration != -1 && !reverse) vd->last_timestamp += duration; - GST_BUFFER_TIMESTAMP (buf) = timestamp; - GST_BUFFER_DURATION (buf) = duration; + GST_LOG_OBJECT (vd, + "keeping timestamp %" GST_TIME_FORMAT " ts %" GST_TIME_FORMAT " dur %" + GST_TIME_FORMAT, GST_TIME_ARGS (vd->last_timestamp), + GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration)); + + if (buf) { + GST_BUFFER_TIMESTAMP (buf) = timestamp; + GST_BUFFER_DURATION (buf) = duration; + } } static GstFlowReturn @@ -850,7 +857,7 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet, { vorbis_sample_t **pcm; guint sample_count; - GstBuffer *out; + GstBuffer *out = NULL; GstFlowReturn result; gint size; @@ -910,6 +917,10 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet, result = vorbis_dec_push_reverse (vd, out); done: + if (out == NULL) { + /* no output, still keep track of timestamps */ + vorbis_do_timestamps (vd, NULL, FALSE, timestamp, duration); + } vorbis_synthesis_read (&vd->vd, sample_count); return result; |