Chromium Code Reviews

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

Issue 2358683002: Android: enable/disable WebRTC HW H264 with a flag. (Closed)
Patch Set: expanding existing switch flag instead of add one more feature Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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 e507936f4f8e7c9bfce91189cb72e3b060c3788c..8a74ae9a58f6256fa4e657689a077294fc585a2a 100644
--- a/media/base/android/media_codec_util.cc
+++ b/media/base/android/media_codec_util.cc
@@ -87,6 +87,12 @@ static bool IsDecoderSupportedByDevice(const std::string& android_mime_type) {
return Java_MediaCodecUtil_isDecoderSupportedForDevice(env, j_mime);
}
+static bool IsH264EncoderSupported() {
+ DCHECK(MediaCodecUtil::IsMediaCodecAvailable());
+ JNIEnv* env = AttachCurrentThread();
+ return Java_MediaCodecUtil_isH264EncoderSupported(env);
+}
+
// static
bool MediaCodecUtil::IsMediaCodecAvailable() {
// MediaCodec is only available on JB and greater.
@@ -211,6 +217,11 @@ bool MediaCodecUtil::IsVp9DecoderAvailable() {
}
// static
+bool MediaCodecUtil::IsH264EncoderAvailable() {
+ return IsMediaCodecAvailable() && IsH264EncoderSupported();
+}
+
+// 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.

Powered by Google App Engine