ext/ogg/gstoggdemux.c: Fix seeking performance in the case where a non-header packet has a 0 granulepos (busted theor...

Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet):
Fix seeking performance in the case where a non-header
packet has a 0 granulepos (busted theora case).
Fixes #341719
This commit is contained in:
Wim Taymans 2006-05-15 15:01:08 +00:00
parent 9d3254cca0
commit beb92d46af
2 changed files with 23 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2006-05-15 Wim Taymans <wim@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet):
Fix seeking performance in the case where a non-header
packet has a 0 granulepos (busted theora case).
Fixes #341719
2006-05-15 Tim-Philipp Müller <tim at centricular dot net> 2006-05-15 Tim-Philipp Müller <tim at centricular dot net>
* gst/subparse/gstsubparse.c: * gst/subparse/gstsubparse.c:

View file

@ -1041,9 +1041,16 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
granule = packet->granulepos; granule = packet->granulepos;
if (granule != -1) { if (granule != -1) {
GST_DEBUG_OBJECT (ogg, "%p has granulepos %lld", pad, granule);
ogg->current_granule = granule; ogg->current_granule = granule;
pad->current_granule = granule; pad->current_granule = granule;
/* granulepos 0 and -1 are considered header packets.
* Note that since theora is busted, it can create non-header
* packets with 0 granulepos. We will correct for this when our
* internal decoder produced a frame and we don't have a
* granulepos because in that case the granulpos must have been 0 */
if (pad->first_granule == -1 && granule != 0) { if (pad->first_granule == -1 && granule != 0) {
GST_DEBUG_OBJECT (ogg, "%p found first granulepos %lld", pad, granule);
pad->first_granule = granule; pad->first_granule = granule;
} }
} }
@ -1059,6 +1066,15 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
if (pad->start_time != GST_CLOCK_TIME_NONE) { if (pad->start_time != GST_CLOCK_TIME_NONE) {
GstOggChain *chain = pad->chain; GstOggChain *chain = pad->chain;
/* correction for busted ogg, if the internal decoder outputed
* a timestamp but we did not get a granulepos, it must have
* been 0 and the time is therefore also 0 */
if (pad->first_time == -1) {
GST_DEBUG_OBJECT (ogg, "%p found start time without granulepos", pad);
pad->first_granule = 0;
pad->first_time = 0;
}
/* check if complete chain has start time */ /* check if complete chain has start time */
if (chain == ogg->building_chain) { if (chain == ogg->building_chain) {