From e12607348918a59dcc42757a3ec293f413b70d54 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 6 Jun 2012 17:42:36 +0100 Subject: [PATCH] oggdemux: reject opus streams with negative start time This is used by Vorbis for sample accurate clipping, but this is deemed an invalid stream by the opus spec. --- ext/ogg/gstoggdemux.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 5f10263f22..031c25d860 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -922,10 +922,16 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet) return GST_FLOW_ERROR; } - if (granule > pad->map.accumulated_granule) + if (granule >= pad->map.accumulated_granule) start_granule = granule - pad->map.accumulated_granule; - else - start_granule = 0; + else { + if (pad->map.forbid_start_clamping) { + GST_ERROR_OBJECT (ogg, "Start of stream maps to negative time"); + return GST_FLOW_ERROR; + } else { + start_granule = 0; + } + } pad->start_time = gst_ogg_stream_granule_to_time (&pad->map, start_granule);