[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-60.2.1esr-8.5-1] Bug 1448014 - avoid needless flattening in AndroidDecoderModule; r=jesup



commit 1e7ee8ad5a57315bda89fb5b1f7fba49e63ccce4
Author: Nathan Froyd <froydnj@xxxxxxxxxxx>
Date:   Mon Jun 18 15:27:06 2018 -0400

    Bug 1448014 - avoid needless flattening in AndroidDecoderModule; r=jesup
---
 dom/media/platforms/android/AndroidDecoderModule.cpp | 12 +++++++-----
 dom/media/platforms/android/AndroidDecoderModule.h   |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dom/media/platforms/android/AndroidDecoderModule.cpp b/dom/media/platforms/android/AndroidDecoderModule.cpp
index df32d9b2f4fd..bffefde46a36 100644
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -33,15 +33,17 @@ namespace mozilla {
 
 mozilla::LazyLogModule sAndroidDecoderModuleLog("AndroidDecoderModule");
 
-const char*
+const nsCString
 TranslateMimeType(const nsACString& aMimeType)
 {
   if (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8)) {
-    return "video/x-vnd.on2.vp8";
+    static NS_NAMED_LITERAL_CSTRING(vp8, "video/x-vnd.on2.vp8");
+    return vp8;
   } else if (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9)) {
-    return "video/x-vnd.on2.vp9";
+    static NS_NAMED_LITERAL_CSTRING(vp9, "video/x-vnd.on2.vp9");
+    return vp9;
   }
-  return PromiseFlatCString(aMimeType).get();
+  return nsCString(aMimeType);
 }
 
 static bool
@@ -112,7 +114,7 @@ AndroidDecoderModule::SupportsMimeType(
   }
 
   return java::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
-    nsCString(TranslateMimeType(aMimeType)));
+    TranslateMimeType(aMimeType));
 }
 
 already_AddRefed<MediaDataDecoder>
diff --git a/dom/media/platforms/android/AndroidDecoderModule.h b/dom/media/platforms/android/AndroidDecoderModule.h
index 86a0766c36e6..4f67965d2b3a 100644
--- a/dom/media/platforms/android/AndroidDecoderModule.h
+++ b/dom/media/platforms/android/AndroidDecoderModule.h
@@ -31,7 +31,7 @@ private:
 
 extern LazyLogModule sAndroidDecoderModuleLog;
 
-const char*
+const nsCString
 TranslateMimeType(const nsACString& aMimeType);
 
 } // namespace mozilla



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits