Commit 3475028d authored by Krishna Govind's avatar Krishna Govind Committed by Ben Mason

Revert "Remove deprecated enable-webrtc-hw-{h264,vp8,vp9}-encoding flags"

This reverts commit a387ca32.

Reason for revert: M80 Stable blocker bug 1046501

Original change's description:
> Remove deprecated enable-webrtc-hw-{h264,vp8,vp9}-encoding flags
> 
> This CL removes the 3 flags  enable-webrtc-hw-{h264,vp8,vp9}-encoding
> because they were deprecated in M76 and will be hidden in M78.  These
> flags are used in peerconnection/rtc_video_encoder_factory.cc to
> filter the supported codecs to be added to the SDP.
> 
> The same filtering effect can be obtained by using the still existing
> flag --disable-webrtc-hw-encoding which is also surfaced to
> chrome:flags and used in peerconnection/video_codec_factory.cc [1],
> albeit at a coarser granularity: no codec-level enable/disable is
> available.
> 
> [1] https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/peerconnection/video_codec_factory.cc?type=cs&q=IsWebRtcHWEncodingEnabled&g=0&l=180
> 
> Bug: 599650
> Change-Id: I35bde6cd50c88ca8641dd9a6bd5a3e44394cde43
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863153
> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> Auto-Submit: Miguel Casas <mcasas@chromium.org>
> Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#708063}

TBR=dgozman@chromium.org,dcheng@google.com,mcasas@chromium.org,pfeldman@chromium.org,foolip@chromium.org,hiroh@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 599650
Change-Id: I6473fb68d3aac1e937da9ded8138befdd857e762
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028852Reviewed-by: default avatarKrishna Govind <govind@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736659}
parent 185be10d
......@@ -1548,6 +1548,14 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kEnableReaderModeDescription, kOsDesktop,
FEATURE_VALUE_TYPE(dom_distiller::kReaderMode)},
#endif // !defined(OS_ANDROID)
{"enable-webrtc-hw-h264-encoding",
flag_descriptions::kWebrtcHwH264EncodingName,
flag_descriptions::kWebrtcHwH264EncodingDescription, kOsAndroid | kOsCrOS,
FEATURE_VALUE_TYPE(blink::features::kWebRtcHWH264Encoding)},
{"enable-webrtc-hw-vp8-encoding",
flag_descriptions::kWebrtcHwVP8EncodingName,
flag_descriptions::kWebrtcHwVP8EncodingDescription, kOsAndroid | kOsCrOS,
FEATURE_VALUE_TYPE(blink::features::kWebRtcHWVP8Encoding)},
#if defined(WEBRTC_USE_PIPEWIRE)
{"enable-webrtc-pipewire-capturer",
flag_descriptions::kWebrtcPipeWireCapturerName,
......@@ -4049,6 +4057,11 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(features::kWebContentsOcclusion)},
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
{"enable-webrtc-hw-vp9-encoding",
flag_descriptions::kWebrtcHwVP9EncodingName,
flag_descriptions::kWebrtcHwVP9EncodingDescription, kOsCrOS,
FEATURE_VALUE_TYPE(blink::features::kWebRtcHWVP9Encoding)},
#if defined(OS_ANDROID)
{"mobile-identity-consistency",
flag_descriptions::kMobileIdentityConsistencyName,
......
......@@ -2110,6 +2110,19 @@ const char kWebrtcHwEncodingName[] = "WebRTC hardware video encoding";
const char kWebrtcHwEncodingDescription[] =
"Support in WebRTC for encoding video streams using platform hardware.";
const char kWebrtcHwH264EncodingName[] = "WebRTC hardware h264 video encoding";
const char kWebrtcHwH264EncodingDescription[] =
"Support in WebRTC for encoding h264 video streams using platform "
"hardware.";
const char kWebrtcHwVP8EncodingName[] = "WebRTC hardware vp8 video encoding";
const char kWebrtcHwVP8EncodingDescription[] =
"Support in WebRTC for encoding vp8 video streams using platform hardware.";
const char kWebrtcHwVP9EncodingName[] = "WebRTC hardware vp9 video encoding";
const char kWebrtcHwVP9EncodingDescription[] =
"Support in WebRTC for encoding vp9 video streams using platform hardware.";
const char kWebrtcNewEncodeCpuLoadEstimatorName[] =
"WebRTC new encode cpu load estimator";
const char kWebrtcNewEncodeCpuLoadEstimatorDescription[] =
......
......@@ -1219,6 +1219,15 @@ extern const char kWebrtcHwDecodingDescription[];
extern const char kWebrtcHwEncodingName[];
extern const char kWebrtcHwEncodingDescription[];
extern const char kWebrtcHwH264EncodingName[];
extern const char kWebrtcHwH264EncodingDescription[];
extern const char kWebrtcHwVP8EncodingName[];
extern const char kWebrtcHwVP8EncodingDescription[];
extern const char kWebrtcHwVP9EncodingName[];
extern const char kWebrtcHwVP9EncodingDescription[];
extern const char kWebrtcNewEncodeCpuLoadEstimatorName[];
extern const char kWebrtcNewEncodeCpuLoadEstimatorDescription[];
......
......@@ -164,6 +164,30 @@ const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
const base::Feature kRTCOfferExtmapAllowMixed{
"RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables HW VP8 encoding on Android.
const base::Feature kWebRtcHWVP8Encoding {
"WebRtcHWVP8Encoding",
#if defined(OS_ANDROID)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif
};
// Enables HW VP9 encoding on Android.
const base::Feature kWebRtcHWVP9Encoding {
"WebRtcHWVP9Encoding",
#if defined(OS_ANDROID)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
// Enables HW H264 encoding on Android.
const base::Feature kWebRtcHWH264Encoding{"WebRtcHWH264Encoding",
base::FEATURE_ENABLED_BY_DEFAULT};
// Enables negotiation of experimental multiplex codec in SDP.
const base::Feature kWebRtcMultiplexCodec{"WebRTC-MultiplexCodec",
base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -47,6 +47,9 @@ BLINK_COMMON_EXPORT extern const base::Feature kRawClipboard;
BLINK_COMMON_EXPORT extern const base::Feature kRTCGetDisplayMedia;
BLINK_COMMON_EXPORT extern const base::Feature kRTCUnifiedPlanByDefault;
BLINK_COMMON_EXPORT extern const base::Feature kRTCOfferExtmapAllowMixed;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcHWH264Encoding;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcHWVP8Encoding;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcHWVP9Encoding;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcMultiplexCodec;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcHideLocalIpsWithMdns;
......
......@@ -29,10 +29,11 @@ base::Optional<webrtc::SdpVideoFormat> VEAToWebRTCFormat(
if (profile.profile >= media::VP8PROFILE_MIN &&
profile.profile <= media::VP8PROFILE_MAX) {
return webrtc::SdpVideoFormat("VP8");
}
if (profile.profile >= media::H264PROFILE_MIN &&
profile.profile <= media::H264PROFILE_MAX) {
if (base::FeatureList::IsEnabled(blink::features::kWebRtcHWVP8Encoding)) {
return webrtc::SdpVideoFormat("VP8");
}
} 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
// checked by kWebRtcH264WithOpenH264FFmpeg flag. This check should be
// removed when SW implementation is fully enabled.
......@@ -41,57 +42,58 @@ base::Optional<webrtc::SdpVideoFormat> VEAToWebRTCFormat(
webrtc_h264_sw_enabled = base::FeatureList::IsEnabled(
blink::features::kWebRtcH264WithOpenH264FFmpeg);
#endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
if (!webrtc_h264_sw_enabled)
return base::nullopt;
webrtc::H264::Profile h264_profile;
switch (profile.profile) {
case media::H264PROFILE_BASELINE:
if (webrtc_h264_sw_enabled ||
base::FeatureList::IsEnabled(blink::features::kWebRtcHWH264Encoding)) {
webrtc::H264::Profile h264_profile;
switch (profile.profile) {
case media::H264PROFILE_BASELINE:
#if defined(OS_ANDROID)
// Force HW H264 on Android to be CBP for most compatibility, since:
// - Only HW H264 is available on Android at present.
// - MediaCodec only advise BP, which works same as CBP in most cases.
// - Some peers only expect CBP in negotiation.
h264_profile = webrtc::H264::kProfileConstrainedBaseline;
// Force HW H264 on Android to be CBP for most compatibility, since:
// - Only HW H264 is available on Android at present.
// - MediaCodec only advise BP, which works same as CBP in most cases.
// - Some peers only expect CBP in negotiation.
h264_profile = webrtc::H264::kProfileConstrainedBaseline;
#else
h264_profile = webrtc::H264::kProfileBaseline;
h264_profile = webrtc::H264::kProfileBaseline;
#endif
break;
case media::H264PROFILE_MAIN:
h264_profile = webrtc::H264::kProfileMain;
break;
case media::H264PROFILE_HIGH:
h264_profile = webrtc::H264::kProfileHigh;
break;
default:
// Unsupported H264 profile in WebRTC.
return base::nullopt;
break;
case media::H264PROFILE_MAIN:
h264_profile = webrtc::H264::kProfileMain;
break;
case media::H264PROFILE_HIGH:
h264_profile = webrtc::H264::kProfileHigh;
break;
default:
// Unsupported H264 profile in WebRTC.
return base::nullopt;
}
const int width = profile.max_resolution.width();
const int height = profile.max_resolution.height();
const int fps = profile.max_framerate_numerator;
DCHECK_EQ(1u, profile.max_framerate_denominator);
const absl::optional<webrtc::H264::Level> h264_level =
webrtc::H264::SupportedLevel(width * height, fps);
const webrtc::H264::ProfileLevelId profile_level_id(
h264_profile, h264_level.value_or(webrtc::H264::kLevel1));
webrtc::SdpVideoFormat format("H264");
format.parameters = {
{cricket::kH264FmtpProfileLevelId,
*webrtc::H264::ProfileLevelIdToString(profile_level_id)},
{cricket::kH264FmtpLevelAsymmetryAllowed, "1"},
{cricket::kH264FmtpPacketizationMode, "1"}};
return format;
}
} else if (profile.profile >= media::VP9PROFILE_MIN &&
profile.profile <= media::VP9PROFILE_MAX) {
if (base::FeatureList::IsEnabled(blink::features::kWebRtcHWVP9Encoding)) {
return webrtc::SdpVideoFormat("VP9");
}
const int width = profile.max_resolution.width();
const int height = profile.max_resolution.height();
const int fps = profile.max_framerate_numerator;
DCHECK_EQ(1u, profile.max_framerate_denominator);
const absl::optional<webrtc::H264::Level> h264_level =
webrtc::H264::SupportedLevel(width * height, fps);
const webrtc::H264::ProfileLevelId profile_level_id(
h264_profile, h264_level.value_or(webrtc::H264::kLevel1));
webrtc::SdpVideoFormat format("H264");
format.parameters = {
{cricket::kH264FmtpProfileLevelId,
*webrtc::H264::ProfileLevelIdToString(profile_level_id)},
{cricket::kH264FmtpLevelAsymmetryAllowed, "1"},
{cricket::kH264FmtpPacketizationMode, "1"}};
return format;
}
if (profile.profile >= media::VP9PROFILE_MIN &&
profile.profile <= media::VP9PROFILE_MAX) {
return webrtc::SdpVideoFormat("VP9");
}
return base::nullopt;
} // namespace
}
bool IsSameFormat(const webrtc::SdpVideoFormat& format1,
const webrtc::SdpVideoFormat& format2) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment