Commit c72a4bf6 authored by Will Cassella's avatar Will Cassella Committed by Commit Bot

Add feature to disable decoder prioritization

By default, `media::DecoderSelector` uses a decoder prioritization
function that tries to balance power and performance with a resolution
-based hardware decoder cutoff. This CL adds a default-disabled feature
to instead use a function that prioritizes nothing, which is useful
for testing.

Bug: 684792
Change-Id: Iac0dc0e12fd9f5a41f344eefcbe002b4a1e84724
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2278702
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785868}
parent 9b78d2aa
...@@ -489,6 +489,11 @@ const base::Feature kHardwareMediaKeyHandling { ...@@ -489,6 +489,11 @@ const base::Feature kHardwareMediaKeyHandling {
#endif #endif
}; };
// Enables a platform-specific resolution cutoff for prioritizing platform
// decoders over software decoders or vice-versa.
const base::Feature kResolutionBasedDecoderPriority{
"ResolutionBasedDecoderPriority", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables low-delay video rendering in media pipeline on "live" stream. // Enables low-delay video rendering in media pipeline on "live" stream.
const base::Feature kLowDelayVideoRenderingOnLiveStream{ const base::Feature kLowDelayVideoRenderingOnLiveStream{
"low-delay-video-rendering-on-live-stream", "low-delay-video-rendering-on-live-stream",
......
...@@ -173,6 +173,7 @@ MEDIA_EXPORT extern const base::Feature kVideoBlitColorAccuracy; ...@@ -173,6 +173,7 @@ MEDIA_EXPORT extern const base::Feature kVideoBlitColorAccuracy;
MEDIA_EXPORT extern const base::Feature kWakeLockOptimisationHiddenMuted; MEDIA_EXPORT extern const base::Feature kWakeLockOptimisationHiddenMuted;
MEDIA_EXPORT extern const base::Feature kWidevineAv1; MEDIA_EXPORT extern const base::Feature kWidevineAv1;
MEDIA_EXPORT extern const base::Feature kWidevineAv1ForceSupportForTesting; MEDIA_EXPORT extern const base::Feature kWidevineAv1ForceSupportForTesting;
MEDIA_EXPORT extern const base::Feature kResolutionBasedDecoderPriority;
#if defined(ARCH_CPU_X86_FAMILY) && defined(OS_CHROMEOS) #if defined(ARCH_CPU_X86_FAMILY) && defined(OS_CHROMEOS)
MEDIA_EXPORT extern const base::Feature kVp9kSVCHWDecoding; MEDIA_EXPORT extern const base::Feature kVp9kSVCHWDecoding;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
#include "media/base/cdm_context.h" #include "media/base/cdm_context.h"
#include "media/base/demuxer_stream.h" #include "media/base/demuxer_stream.h"
#include "media/base/media_log.h" #include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/base/video_decoder.h" #include "media/base/video_decoder.h"
#include "media/filters/decoder_stream_traits.h" #include "media/filters/decoder_stream_traits.h"
#include "media/filters/decrypting_demuxer_stream.h" #include "media/filters/decrypting_demuxer_stream.h"
...@@ -30,6 +32,11 @@ namespace { ...@@ -30,6 +32,11 @@ namespace {
const char kSelectDecoderTrace[] = "DecoderSelector::SelectDecoder"; const char kSelectDecoderTrace[] = "DecoderSelector::SelectDecoder";
template <typename T>
DecoderPriority UnspecifiedDecoderPriority(const T& /*config*/) {
return DecoderPriority::kUnspecified;
}
DecoderPriority GetDefaultVideoDecoderPriority( DecoderPriority GetDefaultVideoDecoderPriority(
const VideoDecoderConfig& config) { const VideoDecoderConfig& config) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -44,18 +51,19 @@ DecoderPriority GetDefaultVideoDecoderPriority( ...@@ -44,18 +51,19 @@ DecoderPriority GetDefaultVideoDecoderPriority(
: DecoderPriority::kPreferPlatformDecoders; : DecoderPriority::kPreferPlatformDecoders;
} }
DecoderPriority GetDefaultAudioDecoderPriority(
const AudioDecoderConfig& /*config*/) {
// Platform audio decoders are not currently prioritized or deprioritized
return DecoderPriority::kUnspecified;
}
void SetDefaultDecoderPriorityCB(VideoDecoderSelector::DecoderPriorityCB* out) { void SetDefaultDecoderPriorityCB(VideoDecoderSelector::DecoderPriorityCB* out) {
if (base::FeatureList::IsEnabled(kResolutionBasedDecoderPriority)) {
*out = base::BindRepeating(GetDefaultVideoDecoderPriority); *out = base::BindRepeating(GetDefaultVideoDecoderPriority);
} else {
*out = base::BindRepeating<DecoderPriority(const VideoDecoderConfig&)>(
UnspecifiedDecoderPriority);
}
} }
void SetDefaultDecoderPriorityCB(AudioDecoderSelector::DecoderPriorityCB* out) { void SetDefaultDecoderPriorityCB(AudioDecoderSelector::DecoderPriorityCB* out) {
*out = base::BindRepeating(GetDefaultAudioDecoderPriority); // Platform audio decoders are not currently prioritized or deprioritized
*out = base::BindRepeating<DecoderPriority(const AudioDecoderConfig&)>(
UnspecifiedDecoderPriority);
} }
} // namespace } // namespace
......
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