Bug 1232911 - [1.2] Allow to test for specific VPX MIME type version. r=cpearce
authorEugen Sawin <esawin@mozilla.com>
Mon, 21 Mar 2016 20:16:50 +0100
changeset 291052 5dfc5468af1c981b150b57f202ab14056fc04100
parent 291051 860aa4598f135cae09f9d69b33f3cbc81f26b6d4
child 291053 36e706a8833eb7735987f7e248b4b9e56d57084e
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1232911
milestone48.0a1
Bug 1232911 - [1.2] Allow to test for specific VPX MIME type version. r=cpearce
dom/media/platforms/agnostic/VPXDecoder.cpp
dom/media/platforms/agnostic/VPXDecoder.h
--- a/dom/media/platforms/agnostic/VPXDecoder.cpp
+++ b/dom/media/platforms/agnostic/VPXDecoder.cpp
@@ -209,16 +209,18 @@ VPXDecoder::Drain()
     NS_NewRunnableMethod(this, &VPXDecoder::DoDrain));
   mTaskQueue->Dispatch(runnable.forget());
 
   return NS_OK;
 }
 
 /* static */
 bool
-VPXDecoder::IsVPX(const nsACString& aMimeType)
+VPXDecoder::IsVPX(const nsACString& aMimeType, uint8_t aCodecMask)
 {
-  return aMimeType.EqualsLiteral("video/webm; codecs=vp8") ||
-    aMimeType.EqualsLiteral("video/webm; codecs=vp9");
+  return ((aCodecMask & VPXDecoder::VP8) &&
+          aMimeType.EqualsLiteral("video/webm; codecs=vp8")) ||
+         ((aCodecMask & VPXDecoder::VP9) &&
+          aMimeType.EqualsLiteral("video/webm; codecs=vp9"));
 }
 
 } // namespace mozilla
 #undef LOG
--- a/dom/media/platforms/agnostic/VPXDecoder.h
+++ b/dom/media/platforms/agnostic/VPXDecoder.h
@@ -33,23 +33,23 @@ public:
   nsresult Flush() override;
   nsresult Drain() override;
   nsresult Shutdown() override;
   const char* GetDescriptionName() const override
   {
     return "libvpx video decoder";
   }
 
-  // Return true if mimetype is a VPX codec
-  static bool IsVPX(const nsACString& aMimeType);
+  enum Codec: uint8_t {
+    VP8 = 1 << 0,
+    VP9 = 1 << 1
+  };
 
-  enum Codec {
-    VP8,
-    VP9
-  };
+  // Return true if mimetype is a VPX codec of given types.
+  static bool IsVPX(const nsACString& aMimeType, uint8_t aCodecMask=VP8|VP9);
 
 private:
   void DecodeFrame (MediaRawData* aSample);
   int DoDecodeFrame (MediaRawData* aSample);
   void DoDrain ();
   void OutputDelayedFrames ();
 
   RefPtr<ImageContainer> mImageContainer;