Commit 347f339c authored by Brett Kilty's avatar Brett Kilty Committed by Commit Bot

Fix multiple sound effects race getting decoder

In cases where kAudioDecoderLimit is > 1, SFX
are getting held to the 1 decoder limit. One decoder
is really about video, as that is the platform
limitation. Multiple sources may attempt to play
sound effects at the same time as these are just
audio only sources.

Bug: b/139941019
Test: Local build, test race condition and SFX.
Change-Id: Ieb7ea18674e58e06dc050f7ff2756e14021ab40d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792451
Commit-Queue: Brett Kilty <brettk@google.com>
Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694833}
parent 8c9d5e78
...@@ -35,12 +35,8 @@ namespace media { ...@@ -35,12 +35,8 @@ namespace media {
namespace { namespace {
#if BUILDFLAG(IS_CAST_AUDIO_ONLY) || BUILDFLAG(ENABLE_ASSISTANT)
constexpr int kAudioDecoderLimit = std::numeric_limits<int>::max(); constexpr int kAudioDecoderLimit = std::numeric_limits<int>::max();
#else constexpr int kVideoDecoderLimit = 1;
constexpr int kAudioDecoderLimit = 1;
#endif
constexpr base::TimeDelta kPowerSaveWaitTime = base::TimeDelta::FromSeconds(5); constexpr base::TimeDelta kPowerSaveWaitTime = base::TimeDelta::FromSeconds(5);
} // namespace } // namespace
...@@ -113,7 +109,8 @@ void MediaPipelineBackendManager::BackendUseVideoDecoder( ...@@ -113,7 +109,8 @@ void MediaPipelineBackendManager::BackendUseVideoDecoder(
bool MediaPipelineBackendManager::IncrementDecoderCount(DecoderType type) { bool MediaPipelineBackendManager::IncrementDecoderCount(DecoderType type) {
DCHECK(media_task_runner_->BelongsToCurrentThread()); DCHECK(media_task_runner_->BelongsToCurrentThread());
DCHECK(type < NUM_DECODER_TYPES); DCHECK(type < NUM_DECODER_TYPES);
const int limit = (type == AUDIO_DECODER) ? kAudioDecoderLimit : 1; const int limit =
(type == VIDEO_DECODER) ? kVideoDecoderLimit : kAudioDecoderLimit;
if (decoder_count_[type] >= limit) { if (decoder_count_[type] >= limit) {
LOG(WARNING) << "Decoder limit reached for type " << type; LOG(WARNING) << "Decoder limit reached for type " << type;
return false; 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