Index: content/common/gpu/media/dxva_video_decode_accelerator.cc |
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
index 568b128e1d1bdea5e0d98bed04fda5db6b54b733..6a578dd157efa8c1d81e16679ca32c6e39ab0f93 100644 |
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
@@ -517,6 +517,7 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( |
dx11_dev_manager_reset_token_(0), |
egl_config_(NULL), |
state_(kUninitialized), |
+ num_picture_buffers_(kNumPictureBuffers), |
pictures_requested_(false), |
inputs_before_decode_(0), |
sent_drain_message_(false), |
@@ -538,9 +539,13 @@ DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
} |
bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
- Client* client) { |
+ uint32_t min_picture_count, |
+ Client* client) { |
client_ = client; |
+ num_picture_buffers_ = std::max(min_picture_count, |
+ static_cast<uint32_t>(kNumPictureBuffers)); |
+ |
main_thread_task_runner_ = base::MessageLoop::current()->task_runner(); |
bool profile_supported = false; |
@@ -777,9 +782,9 @@ void DXVAVideoDecodeAccelerator::AssignPictureBuffers( |
State state = GetState(); |
RETURN_AND_NOTIFY_ON_FAILURE((state != kUninitialized), |
"Invalid state: " << state, ILLEGAL_STATE,); |
- RETURN_AND_NOTIFY_ON_FAILURE((kNumPictureBuffers == buffers.size()), |
+ RETURN_AND_NOTIFY_ON_FAILURE((num_picture_buffers_ == buffers.size()), |
"Failed to provide requested picture buffers. (Got " << buffers.size() << |
- ", requested " << kNumPictureBuffers << ")", INVALID_ARGUMENT,); |
+ ", requested " << num_picture_buffers_ << ")", INVALID_ARGUMENT,); |
// Copy the picture buffers provided by the client to the available list, |
// and mark these buffers as available for use. |
@@ -1479,7 +1484,7 @@ void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) { |
// This task could execute after the decoder has been torn down. |
if (GetState() != kUninitialized && client_) { |
client_->ProvidePictureBuffers( |
- kNumPictureBuffers, |
+ num_picture_buffers_, |
gfx::Size(width, height), |
GL_TEXTURE_2D); |
} |