Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Unified Diff: media/gpu/android_video_decode_accelerator.cc

Issue 2540393002: media: AVDACodecAllocator now fails if threads don't start (Closed)
Patch Set: blah Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/gpu/avda_codec_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_decode_accelerator.cc
diff --git a/media/gpu/android_video_decode_accelerator.cc b/media/gpu/android_video_decode_accelerator.cc
index 1fe3474a03091543b9afcdafc8428583eca5c985..55e49f8f9dff919201065cd4248d0af8fbe8d559 100644
--- a/media/gpu/android_video_decode_accelerator.cc
+++ b/media/gpu/android_video_decode_accelerator.cc
@@ -884,9 +884,9 @@ void AndroidVideoDecodeAccelerator::ConfigureMediaCodecAsynchronously() {
picture_buffer_manager_.CodecChanged(nullptr);
}
- codec_config_->task_type_ =
+ base::Optional<TaskType> task_type =
AVDACodecAllocator::Instance()->TaskTypeForAllocation();
- if (codec_config_->task_type_ == TaskType::FAILED_CODEC) {
+ if (!task_type) {
// If there is no free thread, then just fail.
OnCodecConfigured(nullptr);
return;
@@ -894,12 +894,13 @@ void AndroidVideoDecodeAccelerator::ConfigureMediaCodecAsynchronously() {
// If autodetection is disallowed, fall back to Chrome's software decoders
// instead of using the software decoders provided by MediaCodec.
- if (codec_config_->task_type_ == TaskType::SW_CODEC &&
+ if (task_type == TaskType::SW_CODEC &&
IsMediaCodecSoftwareDecodingForbidden()) {
OnCodecConfigured(nullptr);
return;
}
+ codec_config_->task_type_ = task_type.value();
AVDACodecAllocator::Instance()->CreateMediaCodecAsync(
weak_this_factory_.GetWeakPtr(), codec_config_);
}
@@ -910,13 +911,15 @@ bool AndroidVideoDecodeAccelerator::ConfigureMediaCodecSynchronously() {
DCHECK_NE(state_, WAITING_FOR_CODEC);
state_ = WAITING_FOR_CODEC;
- codec_config_->task_type_ =
+ base::Optional<TaskType> task_type =
AVDACodecAllocator::Instance()->TaskTypeForAllocation();
- if (codec_config_->task_type_ == TaskType::FAILED_CODEC) {
+ if (!task_type) {
+ // If there is no free thread, then just fail.
OnCodecConfigured(nullptr);
return false;
}
+ codec_config_->task_type_ = task_type.value();
std::unique_ptr<VideoCodecBridge> media_codec =
AVDACodecAllocator::Instance()->CreateMediaCodecSync(codec_config_);
OnCodecConfigured(std::move(media_codec));
« no previous file with comments | « no previous file | media/gpu/avda_codec_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698