From 8532e91e7e8d044ee6da01f4d402e7a53d450fc7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 12 May 2007 16:16:22 +0000 Subject: [PATCH] ext/ogg/gstoggdemux.c: If there is a stream in a chain without any data packets, ignore the stream in the total lengt... Original commit message from CVS: * ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet), (gst_ogg_demux_collect_chain_info): If there is a stream in a chain without any data packets, ignore the stream in the total length calculations. Might be related to #436820. --- ChangeLog | 7 +++++++ ext/ogg/gstoggdemux.c | 26 ++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3439383..b2d25fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-12 Wim Taymans + + * ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet), + (gst_ogg_demux_collect_chain_info): + If there is a stream in a chain without any data packets, ignore the + stream in the total length calculations. Might be related to #436820. + 2007-05-11 Jan Schmidt * gst/typefind/gsttypefindfunctions.c: (mpeg_sys_is_valid_pack), diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index f02d294..8067dc1 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -1023,7 +1023,8 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet) /* check if complete chain has start time */ if (chain == ogg->building_chain) { - /* see if we have enough info to activate the chain */ + /* see if we have enough info to activate the chain, we have enough info + * when all streams have a valid start time. */ if (gst_ogg_demux_collect_chain_info (ogg, chain)) { GstEvent *event; GstClockTime segment_start, segment_stop, segment_time; @@ -2564,10 +2565,12 @@ gst_ogg_demux_find_chain (GstOggDemux * ogg, int serialno) return NULL; } +/* returns TRUE if all streams have valid start time */ static gboolean gst_ogg_demux_collect_chain_info (GstOggDemux * ogg, GstOggChain * chain) { gint i; + gboolean res = TRUE; chain->total_time = GST_CLOCK_TIME_NONE; chain->segment_start = G_MAXINT64; @@ -2580,25 +2583,16 @@ gst_ogg_demux_collect_chain_info (GstOggDemux * ogg, GstOggChain * chain) /* can do this if the pad start time is not defined */ if (pad->start_time == GST_CLOCK_TIME_NONE) - goto no_start_time; - - chain->segment_start = MIN (chain->segment_start, pad->start_time); + res = FALSE; + else + chain->segment_start = MIN (chain->segment_start, pad->start_time); } - if (chain->segment_stop != GST_CLOCK_TIME_NONE) + if (chain->segment_stop != GST_CLOCK_TIME_NONE + && chain->segment_start != G_MAXINT64) chain->total_time = chain->segment_stop - chain->segment_start; - return TRUE; - - /* ERROR */ -no_start_time: - { - chain->total_time = GST_CLOCK_TIME_NONE; - chain->segment_start = GST_CLOCK_TIME_NONE; - chain->segment_stop = GST_CLOCK_TIME_NONE; - chain->begin_time = GST_CLOCK_TIME_NONE; - return FALSE; - } + return res; } static void -- 2.7.4