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

Unified Diff: content/renderer/media/gpu/rtc_video_encoder_factory.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
Index: content/renderer/media/gpu/rtc_video_encoder_factory.cc
diff --git a/content/renderer/media/gpu/rtc_video_encoder_factory.cc b/content/renderer/media/gpu/rtc_video_encoder_factory.cc
index f27cc610d3f530bce278bb4be53923d11b2508d8..4e4f5b7be02422f1aad12d4881a0e1a8582c507f 100644
--- a/content/renderer/media/gpu/rtc_video_encoder_factory.cc
+++ b/content/renderer/media/gpu/rtc_video_encoder_factory.cc
@@ -15,6 +15,15 @@
namespace content {
namespace {
+bool IsCodecDisabledByCommandLine(const base::CommandLine* cmd_line,
+ const std::string codec_name) {
+ if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
+ return false;
+
+ const std::string codec_filter =
+ cmd_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding);
+ return codec_filter.empty() || codec_filter == codec_name;
+}
// Translate from media::VideoEncodeAccelerator::SupportedProfile to
// one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec
@@ -29,8 +38,11 @@ void VEAToWebRTCCodecs(
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (profile.profile >= media::VP8PROFILE_MIN &&
profile.profile <= media::VP8PROFILE_MAX) {
- codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
- webrtc::kVideoCodecVP8, "VP8", width, height, fps));
+ if (!IsCodecDisabledByCommandLine(cmd_line,
+ switches::kDisableWebRtcHWEncodingVPx)) {
+ codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
+ webrtc::kVideoCodecVP8, "VP8", width, height, fps));
+ }
} else if (profile.profile >= media::H264PROFILE_MIN &&
profile.profile <= media::H264PROFILE_MAX) {
// Enable H264 HW encode for WebRTC when SW fallback is available, which is
@@ -44,7 +56,9 @@ void VEAToWebRTCCodecs(
base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg);
#endif // BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG)
if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) ||
- webrtc_h264_sw_enabled) {
+ webrtc_h264_sw_enabled ||
+ !IsCodecDisabledByCommandLine(cmd_line,
+ switches::kDisableWebRtcHWEncodingH264)) {
codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
webrtc::kVideoCodecH264, "H264", width, height, fps));
}
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/media/webrtc/peer_connection_dependency_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698