Bug 1330284 - Use MediaCodecs::Range() in DecoderTraits:CanHandleCodecsType() - r?jya
MozReview-Commit-ID: EFiDpSKw2JN
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -2,17 +2,16 @@
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DecoderTraits.h"
#include "MediaContentType.h"
#include "MediaDecoder.h"
-#include "nsCharSeparatedTokenizer.h"
#include "nsMimeTypes.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "OggDecoder.h"
#include "OggDemuxer.h"
#include "WebMDecoder.h"
@@ -175,31 +174,21 @@ CanHandleCodecsType(const MediaContentTy
}
#endif
if (!codecList) {
return CANPLAY_MAYBE;
}
// See http://www.rfc-editor.org/rfc/rfc4281.txt for the description
// of the 'codecs' parameter
- nsCharSeparatedTokenizer
- tokenizer(aType.ExtendedType().Codecs().AsString(), ',');
- bool expectMoreTokens = false;
- while (tokenizer.hasMoreTokens()) {
- const nsSubstring& token = tokenizer.nextToken();
-
+ for (const auto& token : aType.ExtendedType().Codecs().Range()) {
if (!CodecListContains(codecList, token)) {
// Totally unsupported codec
return CANPLAY_NO;
}
- expectMoreTokens = tokenizer.separatorAfterCurrentToken();
- }
- if (expectMoreTokens) {
- // Last codec name was empty
- return CANPLAY_NO;
}
return CANPLAY_YES;
}
static
CanPlayStatus
CanHandleMediaType(const MediaContentType& aType,