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

Unified Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 1207043002: Introduce a client minimum picture pool size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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
Index: content/renderer/pepper/video_decoder_shim.cc
diff --git a/content/renderer/pepper/video_decoder_shim.cc b/content/renderer/pepper/video_decoder_shim.cc
index ec176bff069901b7f53c35e40a6dda8cb84196da..bfd71310545b4b262ae87df636ab55e336b6c268 100644
--- a/content/renderer/pepper/video_decoder_shim.cc
+++ b/content/renderer/pepper/video_decoder_shim.cc
@@ -627,13 +627,13 @@ class VideoDecoderShim::DecoderImpl {
explicit DecoderImpl(const base::WeakPtr<VideoDecoderShim>& proxy);
~DecoderImpl();
- void Initialize(media::VideoDecoderConfig config);
+ void Initialize(media::VideoDecoderConfig config, uint32_t min_picture_count);
void Decode(uint32_t decode_id, scoped_refptr<media::DecoderBuffer> buffer);
void Reset();
void Stop();
private:
- void OnInitDone(bool success);
+ void OnInitDone(uint32_t min_picture_count, bool success);
void DoDecode();
void OnDecodeComplete(media::VideoDecoder::Status status);
void OnOutputComplete(const scoped_refptr<media::VideoFrame>& frame);
@@ -671,7 +671,7 @@ VideoDecoderShim::DecoderImpl::~DecoderImpl() {
}
void VideoDecoderShim::DecoderImpl::Initialize(
- media::VideoDecoderConfig config) {
+ media::VideoDecoderConfig config, uint32_t min_picture_count) {
DCHECK(!decoder_);
#if !defined(MEDIA_DISABLE_LIBVPX)
if (config.codec() == media::kCodecVP9) {
@@ -693,7 +693,7 @@ void VideoDecoderShim::DecoderImpl::Initialize(
decoder_->Initialize(
config, true /* low_delay */,
base::Bind(&VideoDecoderShim::DecoderImpl::OnInitDone,
- weak_ptr_factory_.GetWeakPtr()),
+ weak_ptr_factory_.GetWeakPtr(), min_picture_count),
base::Bind(&VideoDecoderShim::DecoderImpl::OnOutputComplete,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -731,11 +731,14 @@ void VideoDecoderShim::DecoderImpl::Stop() {
// This instance is deleted once we exit this scope.
}
-void VideoDecoderShim::DecoderImpl::OnInitDone(bool success) {
+void VideoDecoderShim::DecoderImpl::OnInitDone(
+ uint32_t min_picture_count, bool success) {
int32_t result = success ? PP_OK : PP_ERROR_NOTSUPPORTED;
// Calculate how many textures the shim should create.
- uint32_t shim_texture_pool_size = media::limits::kMaxVideoFrames + 1;
+ uint32_t shim_texture_pool_size =
+ std::max(static_cast<uint32_t>(media::limits::kMaxVideoFrames + 1),
+ min_picture_count);
main_task_runner_->PostTask(
FROM_HERE, base::Bind(&VideoDecoderShim::OnInitializeComplete, shim_,
result, shim_texture_pool_size));
@@ -843,6 +846,7 @@ VideoDecoderShim::~VideoDecoderShim() {
bool VideoDecoderShim::Initialize(
media::VideoCodecProfile profile,
+ uint32 min_picture_count,
media::VideoDecodeAccelerator::Client* client) {
DCHECK_EQ(client, host_);
DCHECK(RenderThreadImpl::current());
@@ -875,7 +879,8 @@ bool VideoDecoderShim::Initialize(
FROM_HERE,
base::Bind(&VideoDecoderShim::DecoderImpl::Initialize,
base::Unretained(decoder_impl_.get()),
- config));
+ config,
+ min_picture_count));
// Return success, even though we are asynchronous, to mimic
// media::VideoDecodeAccelerator.
return true;

Powered by Google App Engine
This is Rietveld 408576698