Commit 95b0d59a authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

[MediaStream] Add feature flag for enforcement of max frame rate

This CL adds a new feature flag that allows controlling how max frame
rates are enforced for MediaStreamTracks.
With the flag disabled (default), enforcement relies on system
configuration. With the flag enabled, enforcement relies on frame-rate
adjustments by the track.

Bug: 1152307
Change-Id: Idd158aa17a9c03215b59c68b89c8a0e74a7a2ece
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557497Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830942}
parent 2db1fcb7
......@@ -824,5 +824,10 @@ const base::Feature kLoadingTasksUnfreezable{"LoadingTasksUnfreezable",
// noopener behavior by default. TODO(crbug.com/898942): Remove in Chrome 95.
const base::Feature kTargetBlankImpliesNoOpener{
"TargetBlankImpliesNoOpener", base::FEATURE_ENABLED_BY_DEFAULT};
// Controls how max frame rates are enforced in MediaStreamTracks.
// TODO(crbug.com/1152307): Remove in M91.
const base::Feature kMediaStreamTrackUseConfigMaxFrameRate{
"MediaStreamTrackUseConfigMaxFrameRate", base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace blink
......@@ -338,6 +338,9 @@ BLINK_COMMON_EXPORT extern const base::Feature kWebRtcLibvpxEncodeNV12;
BLINK_COMMON_EXPORT extern const base::Feature kLoadingTasksUnfreezable;
BLINK_COMMON_EXPORT extern const base::Feature kTargetBlankImpliesNoOpener;
BLINK_COMMON_EXPORT extern const base::Feature
kMediaStreamTrackUseConfigMaxFrameRate;
} // namespace features
} // namespace blink
......
......@@ -22,6 +22,7 @@
#include "media/base/bind_to_current_loop.h"
#include "media/base/limits.h"
#include "media/base/video_util.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/modules/mediastream/video_track_adapter_settings.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
......@@ -409,7 +410,11 @@ bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_);
// Do not drop frames if max frame rate hasn't been specified.
if (settings_.max_frame_rate() == 0.0f) {
if (settings_.max_frame_rate() == 0.0f ||
(base::FeatureList::IsEnabled(
features::kMediaStreamTrackUseConfigMaxFrameRate) &&
source_frame_rate > 0 &&
source_frame_rate <= settings_.max_frame_rate())) {
last_time_stamp_ = frame.timestamp();
return false;
}
......
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