Bug 1330284 - Use MediaCodecs::Range() in DecoderTraits:CanHandleCodecsType() - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 22 Dec 2016 10:12:42 +1100
changeset 374477 e0c2f4a53ca10552a609d776a9faecb94b8fa376
parent 374476 7456fe7977717aabce8a901164e73b8cf4fa3765
child 374478 f58848e55b8c2c65dbfd9a30c8bbd30f8fe6fe9f
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1330284
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1330284 - Use MediaCodecs::Range() in DecoderTraits:CanHandleCodecsType() - r=jya MozReview-Commit-ID: EFiDpSKw2JN
dom/media/DecoderTraits.cpp
--- 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,