From 325004d7f10b325789be51ba7656c7ba76675973 Mon Sep 17 00:00:00 2001 From: Anthony Jones Date: Wed, 12 Nov 2014 16:37:43 +1300 Subject: [PATCH] Bug 1096157 - Add IsMediaSegmentPresent() for MP4; r=mattwoodrow --- dom/media/mediasource/ContainerParser.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index 436182404ae..33a994621c9 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -218,6 +218,22 @@ public: aData[7] == 'p'; } + bool IsMediaSegmentPresent(const uint8_t* aData, uint32_t aLength) + { + ContainerParser::IsMediaSegmentPresent(aData, aLength); + if (aLength < 8) { + return false; + } + + uint32_t chunk_size = BigEndian::readUint32(aData); + if (chunk_size < 8) { + return false; + } + + return aData[4] == 'm' && aData[5] == 'o' && aData[6] == 'o' && + aData[7] == 'f'; + } + bool ParseStartAndEndTimestamps(const uint8_t* aData, uint32_t aLength, int64_t& aStart, int64_t& aEnd) {