Index: media/filters/gpu_video_decoder.cc |
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
index b7229f00124e94c3c77d383ed47639b94336984f..004b14015648587e027b2cc7d4ff05105e2c1a2b 100644 |
--- a/media/filters/gpu_video_decoder.cc |
+++ b/media/filters/gpu_video_decoder.cc |
@@ -68,6 +68,7 @@ GpuVideoDecoder::GpuVideoDecoder(GpuVideoAcceleratorFactories* factories) |
next_picture_buffer_id_(0), |
next_bitstream_buffer_id_(0), |
available_pictures_(0), |
+ can_stall_anytime_(false), |
weak_factory_(this) { |
DCHECK(factories_); |
} |
@@ -154,7 +155,9 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
return; |
} |
- if (!IsProfileSupported(config.profile(), config.coded_size())) { |
+ VideoDecodeAccelerator::SupportedProfile matching_profile; |
+ if (!IsProfileSupported(config.profile(), config.coded_size(), |
+ matching_profile)) { |
DVLOG(1) << "Profile " << config.profile() << " or coded size " |
<< config.coded_size().ToString() << " not supported."; |
bound_init_cb.Run(false); |
@@ -162,6 +165,9 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
} |
config_ = config; |
+ can_stall_anytime_ = |
+ matching_profile.flags & |
+ VideoDecodeAccelerator::SupportedProfile::kCanStallAnytime; |
needs_bitstream_conversion_ = (config.codec() == kCodecH264); |
output_cb_ = BindToCurrentLoop(output_cb); |
@@ -351,9 +357,9 @@ bool GpuVideoDecoder::NeedsBitstreamConversion() const { |
bool GpuVideoDecoder::CanReadWithoutStalling() const { |
DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
- return |
- next_picture_buffer_id_ == 0 || // Decode() will ProvidePictureBuffers(). |
- available_pictures_ > 0; |
+ return next_picture_buffer_id_ == |
+ 0 || // Decode() will ProvidePictureBuffers(). |
+ (!can_stall_anytime_ && available_pictures_ > 0); |
} |
int GpuVideoDecoder::GetMaxDecodeRequests() const { |
@@ -640,13 +646,16 @@ void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) { |
DestroyVDA(); |
} |
-bool GpuVideoDecoder::IsProfileSupported(VideoCodecProfile profile, |
- const gfx::Size& coded_size) { |
+bool GpuVideoDecoder::IsProfileSupported( |
+ VideoCodecProfile profile, |
+ const gfx::Size& coded_size, |
+ VideoDecodeAccelerator::SupportedProfile& matching_profile_out) { |
DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
VideoDecodeAccelerator::SupportedProfiles supported_profiles = |
factories_->GetVideoDecodeAcceleratorSupportedProfiles(); |
for (const auto& supported_profile : supported_profiles) { |
if (profile == supported_profile.profile) { |
+ matching_profile_out = supported_profile; |
return IsCodedSizeSupported(coded_size, |
supported_profile.min_resolution, |
supported_profile.max_resolution); |