Chromium Code Reviews| 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..18bef573952a1f838f01d0ba11c395aaf807f197 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,10 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| return; |
| } |
| - if (!IsProfileSupported(config.profile(), config.coded_size())) { |
| + VideoDecodeAccelerator::Capabilities capabilities = |
| + factories_->GetVideoDecodeAcceleratorCapabilities(); |
| + if (!IsProfileSupported(capabilities, config.profile(), |
| + config.coded_size())) { |
| DVLOG(1) << "Profile " << config.profile() << " or coded size " |
| << config.coded_size().ToString() << " not supported."; |
| bound_init_cb.Run(false); |
| @@ -162,6 +166,8 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| } |
| config_ = config; |
| + can_stall_anytime_ = capabilities.flags & |
| + VideoDecodeAccelerator::Capabilities::CAN_STALL_ANY_TIME; |
| 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); |
|
Pawel Osciak
2015/12/05 00:18:55
The indents here seem wrong...
liberato (no reviews please)
2015/12/07 19:04:39
not sure, but it's what cl format does.
Pawel Osciak
2015/12/09 01:31:48
Maybe it gets confused by the inline comment? I th
|
| } |
| int GpuVideoDecoder::GetMaxDecodeRequests() const { |
| @@ -640,11 +646,13 @@ void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) { |
| DestroyVDA(); |
| } |
| -bool GpuVideoDecoder::IsProfileSupported(VideoCodecProfile profile, |
| - const gfx::Size& coded_size) { |
| +bool GpuVideoDecoder::IsProfileSupported( |
| + const VideoDecodeAccelerator::Capabilities& capabilities, |
| + VideoCodecProfile profile, |
| + const gfx::Size& coded_size) { |
| DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| - VideoDecodeAccelerator::SupportedProfiles supported_profiles = |
| - factories_->GetVideoDecodeAcceleratorSupportedProfiles(); |
| + const VideoDecodeAccelerator::SupportedProfiles& supported_profiles = |
| + capabilities.supported_profiles; |
| for (const auto& supported_profile : supported_profiles) { |
|
Pawel Osciak
2015/12/05 00:18:55
Nit: Personally I'd just s/supported_profiles/capa
liberato (no reviews please)
2015/12/07 19:04:39
Done.
|
| if (profile == supported_profile.profile) { |
| return IsCodedSizeSupported(coded_size, |