Skip to content

Commit

Permalink
[M98] Revert "Enable constrained baseline profile for H.264 HW encode."
Browse files Browse the repository at this point in the history
This reverts commit 40c17c7.

Reason for revert: With CBP enabled for HWMFT, we are seeing abnormally
high key frame generation rate (50 to 300 frames per minute). In
addition, resolution doesn't scale up past 360p. The expectation is
720p. Reverting this commit which enabled CBP for H.264 HW Encode to
mitigate the issue.

Bug: 1295815

Original change's description:
> Enable constrained baseline profile for H.264 HW encode.
>
> This patch enables hardware H.264 CBP encoding on Windows,
> and it may have problems on other platforms, like Mac in
> https://crbug.com/1088650. Also, Nvidia RTX 2060 series are
> temporarily disabled until they provide fix to it.
>
> Bug: 982799, 1088650
> Change-Id: I0463edf30f3d7152a3dc0f8d0b41aede872efa85
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3268587
> Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
> Commit-Queue: Chunbo Hua <chunbo.hua@intel.com>
> Cr-Commit-Position: refs/heads/main@{#944358}

(cherry picked from commit e686a30)

Bug: 982799, 1088650
Change-Id: I9d94d6290e6a186c0a445f8d277dcdb4c42bbd6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3450338
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Rahul Singh <rahsin@microsoft.com>
Cr-Original-Commit-Position: refs/heads/main@{#969265}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3453867
Reviewed-by: Srinivas Sista <srinivassista@chromium.org>
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
Owners-Override: Srinivas Sista <srinivassista@chromium.org>
Cr-Commit-Position: refs/branch-heads/4758@{#1148}
Cr-Branched-From: 4a2cf4b-refs/heads/main@{#950365}
  • Loading branch information
rahulsingh-msft authored and Chromium LUCI CQ committed Feb 11, 2022
1 parent ecb61f5 commit faedf8e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
19 changes: 2 additions & 17 deletions media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ bool MediaFoundationVideoEncodeAccelerator::Initialize(const Config& config,
return false;
}

if (!ActivateAsyncEncoder(pp_activate, encoder_count,
config.is_constrained_h264)) {
if (!ActivateAsyncEncoder(pp_activate, encoder_count)) {
DLOG(ERROR) << "Failed activating an async hardware encoder MFT.";

if (pp_activate) {
Expand Down Expand Up @@ -618,8 +617,7 @@ uint32_t MediaFoundationVideoEncodeAccelerator::EnumerateHardwareEncoders(

bool MediaFoundationVideoEncodeAccelerator::ActivateAsyncEncoder(
IMFActivate** pp_activate,
uint32_t encoder_count,
bool is_constrained_h264) {
uint32_t encoder_count) {
DVLOG(3) << __func__;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

Expand All @@ -634,19 +632,6 @@ bool MediaFoundationVideoEncodeAccelerator::ActivateAsyncEncoder(
DCHECK(SUCCEEDED(hr));
auto vendor = GetDriverVendor(pp_activate[i]);

// Skip NVIDIA GPU due to https://crbug.com/1088650 for constrained
// baseline profile H.264 encoding, and go to the next instance
// according to merit value.
if (vendor == DriverVendor::kNvidia && codec_ == VideoCodec::kH264 &&
is_constrained_h264) {
DLOG(WARNING)
<< "Skipped NVIDIA GPU due to https://crbug.com/1088650";
pp_activate[i]->ShutdownObject();
encoder_.Reset();
hr = E_FAIL;
continue;
}

activate_ = pp_activate[i];
vendor_ = vendor;
pp_activate[i] = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ class MEDIA_GPU_EXPORT MediaFoundationVideoEncodeAccelerator

// Activates the asynchronous encoder instance |encoder_| according to codec
// merit.
bool ActivateAsyncEncoder(IMFActivate** pp_activate,
uint32_t activate_count,
bool is_constrained_h264);
bool ActivateAsyncEncoder(IMFActivate** pp_activate, uint32_t activate_count);

// Initializes and allocates memory for input and output parameters.
bool InitializeInputOutputParameters(VideoCodecProfile output_profile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,6 @@ SupportedFormats GetSupportedFormatsInternal(
supported_formats.profiles.push_back(profile.profile);
supported_formats.scalability_modes.push_back(profile.scalability_modes);
supported_formats.sdp_formats.push_back(std::move(*format));

#if defined(OS_WIN)
if (profile.profile == media::VideoCodecProfile::H264PROFILE_BASELINE) {
supported_formats.profiles.push_back(profile.profile);
supported_formats.scalability_modes.push_back(
profile.scalability_modes);
cricket::AddH264ConstrainedBaselineProfileToSupportedFormats(
&supported_formats.sdp_formats);
}
#endif
}
}

Expand Down

0 comments on commit faedf8e

Please sign in to comment.