summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-05-05 23:04:10 +0300
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-05-07 13:42:33 +0200
commit823eca65a47a7bab6c6bfe246daa33d682987637 (patch)
tree2762adb2e4859b4cc34f41177500346981944057 /dom
parent7e1f4f430f7e834b7cea7a010d7b8efd576851fe (diff)
downloadUXP-823eca65a47a7bab6c6bfe246daa33d682987637.tar
UXP-823eca65a47a7bab6c6bfe246daa33d682987637.tar.gz
UXP-823eca65a47a7bab6c6bfe246daa33d682987637.tar.lz
UXP-823eca65a47a7bab6c6bfe246daa33d682987637.tar.xz
UXP-823eca65a47a7bab6c6bfe246daa33d682987637.zip
Issue #1536 - Part 3: Parse content to decide whether it's an init segment.
Diffstat (limited to 'dom')
-rw-r--r--dom/media/mediasource/ContainerParser.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp
index 628f8d7cd..9711d4fb6 100644
--- a/dom/media/mediasource/ContainerParser.cpp
+++ b/dom/media/mediasource/ContainerParser.cpp
@@ -127,28 +127,18 @@ public:
MediaResult IsInitSegmentPresent(MediaByteBuffer* aData) override
{
ContainerParser::IsInitSegmentPresent(aData);
- // XXX: This is overly primitive, needs to collect data as it's appended
- // to the SB and handle, rather than assuming everything is present in a
- // single aData segment.
- // 0x1a45dfa3 // EBML
- // ...
- // DocType == "webm"
- // ...
- // 0x18538067 // Segment (must be "unknown" size or contain a value large
- // enough to include the Segment Information and Tracks
- // elements that follow)
- // 0x1549a966 // -> Segment Info
- // 0x1654ae6b // -> One or more Tracks
-
- // 0x1a45dfa3 // EBML
if (aData->Length() < 4) {
return NS_ERROR_NOT_AVAILABLE;
}
- if ((*aData)[0] == 0x1a && (*aData)[1] == 0x45 && (*aData)[2] == 0xdf &&
- (*aData)[3] == 0xa3) {
- return NS_OK;
+ WebMBufferedParser parser(0);
+ nsTArray<WebMTimeDataOffset> mapping;
+ ReentrantMonitor dummy("dummy");
+ bool result = parser.Append(aData->Elements(), aData->Length(), mapping,
+ dummy);
+ if (!result) {
+ return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content"));
}
- return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content"));
+ return parser.mInitEndOffset > 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE;
}
MediaResult IsMediaSegmentPresent(MediaByteBuffer* aData) override