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

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: 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. 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..abbe6cfa097352821d35aa7cc087f6d159938d4c 100644
--- a/content/renderer/media/gpu/rtc_video_encoder_factory.cc
+++ b/content/renderer/media/gpu/rtc_video_encoder_factory.cc
@@ -15,6 +15,18 @@
namespace content {
namespace {
+bool IsCodecDisabledByCommanLine(std::string codec_name) {
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
DaleCurtis 2016/09/29 00:31:36 Pass in?
braveyao 2016/09/29 19:26:26 Done.
+ bool result = true;
+ if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding) ||
DaleCurtis 2016/09/29 00:31:35 early return. store getswithvalueascii for compari
braveyao 2016/09/29 19:26:26 Done.
+ (!cmd_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding)
+ .empty() &&
+ cmd_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding) !=
+ codec_name)) {
+ result = false;
+ }
+ return result;
+}
// Translate from media::VideoEncodeAccelerator::SupportedProfile to
// one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec
@@ -29,8 +41,10 @@ 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 (!IsCodecDisabledByCommanLine(switches::kDisableWebRtcHWEncodingVPx)) {
DaleCurtis 2016/09/29 00:31:35 CommandLine.
braveyao 2016/09/29 19:26:26 Done.
+ 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 +58,8 @@ void VEAToWebRTCCodecs(
base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg);
#endif // BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG)
if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) ||
DaleCurtis 2016/09/29 00:31:36 Can this flag be deleted now?
braveyao 2016/09/29 19:26:26 No. This is for extension on Mac. please see the c
DaleCurtis 2016/09/29 19:34:14 How is that flag passed? Can you remove that flag
braveyao 2016/09/30 18:22:02 You are right. I'll discuss with other and follow
- webrtc_h264_sw_enabled) {
+ webrtc_h264_sw_enabled ||
+ !IsCodecDisabledByCommanLine(switches::kDisableWebRtcHWEncodingH264)) {
codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
webrtc::kVideoCodecH264, "H264", width, height, fps));
}

Powered by Google App Engine
This is Rietveld 408576698