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)); |
} |