From 928589a0d14a4174cb95753faf89a7b4e81abbd2 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 21 Jul 2016 17:56:01 +1000 Subject: [PATCH] Bug 1168674: [ogg] P4. Skip over header packets when seeking close to the start. r=brion+1012 MozReview-Commit-ID: F0Ezo0yfOyo --HG-- extra : rebase_source : aac013a5b6065efed696e9929c63789f72ee1f5d --- dom/media/ogg/OggDemuxer.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dom/media/ogg/OggDemuxer.cpp b/dom/media/ogg/OggDemuxer.cpp index 9f72a0a2c174..db91abbface5 100644 --- a/dom/media/ogg/OggDemuxer.cpp +++ b/dom/media/ogg/OggDemuxer.cpp @@ -862,11 +862,23 @@ RefPtr OggDemuxer::GetNextPacket(TrackInfo::TrackType aType) { OggCodecState* state = GetTrackCodecState(aType); - DemuxUntilPacketAvailable(state); + ogg_packet* packet = nullptr; + + do { + if (packet) { + OggCodecState::ReleasePacket(state->PacketOut()); + } + DemuxUntilPacketAvailable(state); + + packet = state->PacketPeek(); + } while (packet && state->IsHeader(packet)); + + if (!packet) { + return nullptr; + } // Check the eos state in case we need to look for chained streams. - ogg_packet* packet = state->PacketPeek(); - bool eos = packet && packet->e_o_s; + bool eos = packet->e_o_s; RefPtr data = state->PacketOutAsMediaRawData();;