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

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

Issue 2106133003: [M52] Make AVDA fall back to software decoding if needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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/sdk_media_codec_bridge.h ('k') | media/gpu/android_video_decode_accelerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/sdk_media_codec_bridge.cc
diff --git a/media/base/android/sdk_media_codec_bridge.cc b/media/base/android/sdk_media_codec_bridge.cc
index 840f57724c06560fdfbe78e21d7b7eaa038ecf04..a627c94271a7c8c8b0f021bd84f36178b6c38069 100644
--- a/media/base/android/sdk_media_codec_bridge.cc
+++ b/media/base/android/sdk_media_codec_bridge.cc
@@ -81,13 +81,14 @@ static const std::string VideoCodecToAndroidMimeType(const VideoCodec& codec) {
SdkMediaCodecBridge::SdkMediaCodecBridge(const std::string& mime,
bool is_secure,
- MediaCodecDirection direction) {
+ MediaCodecDirection direction,
+ bool require_software_codec) {
JNIEnv* env = AttachCurrentThread();
CHECK(env);
DCHECK(!mime.empty());
ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime);
- j_media_codec_.Reset(
- Java_MediaCodecBridge_create(env, j_mime.obj(), is_secure, direction));
+ j_media_codec_.Reset(Java_MediaCodecBridge_create(
+ env, j_mime.obj(), is_secure, direction, require_software_codec));
}
SdkMediaCodecBridge::~SdkMediaCodecBridge() {
@@ -333,6 +334,11 @@ MediaCodecStatus SdkMediaCodecBridge::GetOutputBufferAddress(
return MEDIA_CODEC_OK;
}
+bool SdkMediaCodecBridge::IsSoftwareCodec() {
+ JNIEnv* env = AttachCurrentThread();
+ return Java_MediaCodecBridge_isSoftwareCodec(env, j_media_codec_.obj());
+}
+
// static
bool SdkMediaCodecBridge::RegisterSdkMediaCodecBridge(JNIEnv* env) {
return RegisterNativesImpl(env);
@@ -363,7 +369,7 @@ bool AudioCodecBridge::IsKnownUnaccelerated(const AudioCodec& codec) {
AudioCodecBridge::AudioCodecBridge(const std::string& mime)
// Audio codec doesn't care about security level and there is no need for
// audio encoding yet.
- : SdkMediaCodecBridge(mime, false, MEDIA_CODEC_DECODER) {}
+ : SdkMediaCodecBridge(mime, false, MEDIA_CODEC_DECODER, false) {}
bool AudioCodecBridge::ConfigureAndStart(const AudioDecoderConfig& config,
bool play_audio,
@@ -609,13 +615,13 @@ bool VideoCodecBridge::IsKnownUnaccelerated(const VideoCodec& codec,
}
// static
-VideoCodecBridge* VideoCodecBridge::CreateDecoder(
- const VideoCodec& codec,
- bool is_secure,
- const gfx::Size& size,
- jobject surface,
- jobject media_crypto,
- bool allow_adaptive_playback) {
+VideoCodecBridge* VideoCodecBridge::CreateDecoder(const VideoCodec& codec,
+ bool is_secure,
+ const gfx::Size& size,
+ jobject surface,
+ jobject media_crypto,
+ bool allow_adaptive_playback,
+ bool require_software_codec) {
if (!MediaCodecUtil::IsMediaCodecAvailable())
return nullptr;
@@ -623,8 +629,8 @@ VideoCodecBridge* VideoCodecBridge::CreateDecoder(
if (mime.empty())
return nullptr;
- std::unique_ptr<VideoCodecBridge> bridge(
- new VideoCodecBridge(mime, is_secure, MEDIA_CODEC_DECODER));
+ std::unique_ptr<VideoCodecBridge> bridge(new VideoCodecBridge(
+ mime, is_secure, MEDIA_CODEC_DECODER, require_software_codec));
if (!bridge->media_codec())
return nullptr;
@@ -658,7 +664,7 @@ VideoCodecBridge* VideoCodecBridge::CreateEncoder(const VideoCodec& codec,
return nullptr;
std::unique_ptr<VideoCodecBridge> bridge(
- new VideoCodecBridge(mime, false, MEDIA_CODEC_ENCODER));
+ new VideoCodecBridge(mime, false, MEDIA_CODEC_ENCODER, false));
if (!bridge->media_codec())
return nullptr;
@@ -680,8 +686,9 @@ VideoCodecBridge* VideoCodecBridge::CreateEncoder(const VideoCodec& codec,
VideoCodecBridge::VideoCodecBridge(const std::string& mime,
bool is_secure,
- MediaCodecDirection direction)
- : SdkMediaCodecBridge(mime, is_secure, direction),
+ MediaCodecDirection direction,
+ bool require_software_codec)
+ : SdkMediaCodecBridge(mime, is_secure, direction, require_software_codec),
adaptive_playback_supported_for_testing_(-1) {}
void VideoCodecBridge::SetVideoBitrate(int bps) {
« no previous file with comments | « media/base/android/sdk_media_codec_bridge.h ('k') | media/gpu/android_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698