Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: media/base/android/media_codec_util.cc

Issue 2358683002: Android: enable/disable WebRTC HW H264 with a flag. (Closed)
Patch Set: rebase to Oct17 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_codec_util.h ('k') | media/gpu/android_video_encode_accelerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_codec_util.cc
diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc
index 568131ee9f2154632ce80d39df58e64fbe973390..467449f1262ead3a0438571bf52e55f9bb16a7db 100644
--- a/media/base/android/media_codec_util.cc
+++ b/media/base/android/media_codec_util.cc
@@ -87,6 +87,14 @@ static bool IsDecoderSupportedByDevice(const std::string& android_mime_type) {
return Java_MediaCodecUtil_isDecoderSupportedForDevice(env, j_mime);
}
+static bool IsEncoderSupportedByDevice(const std::string& android_mime_type) {
+ DCHECK(MediaCodecUtil::IsMediaCodecAvailable());
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jstring> j_mime =
+ ConvertUTF8ToJavaString(env, android_mime_type);
+ return Java_MediaCodecUtil_isEncoderSupportedByDevice(env, j_mime);
+}
+
// static
bool MediaCodecUtil::IsMediaCodecAvailable() {
// Blacklist some devices on Jellybean as MediaCodec is buggy.
@@ -212,6 +220,11 @@ bool MediaCodecUtil::IsVp9DecoderAvailable() {
}
// static
+bool MediaCodecUtil::IsH264EncoderAvailable() {
+ return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kAvcMimeType);
+}
+
+// static
bool MediaCodecUtil::IsSurfaceViewOutputSupported() {
// Disable SurfaceView output for the Samsung Galaxy S3; it does not work
// well enough for even 360p24 H264 playback. http://crbug.com/602870.
« no previous file with comments | « media/base/android/media_codec_util.h ('k') | media/gpu/android_video_encode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698