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

Unified Diff: content/common/gpu/media/android_video_decode_accelerator.cc

Issue 1745903002: Introduce GpuVideoDecodeAcceleratorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/common/gpu/media/android_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc
index 7deb6f3dc81cbe36be666f2354ac8591e5b71950..9e70cd45d68426729e1426d60cba7ea182658d82 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.cc
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc
@@ -229,16 +229,16 @@ static base::LazyInstance<AVDATimerManager>::Leaky g_avda_timer =
LAZY_INSTANCE_INITIALIZER;
AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
- const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder,
- const base::Callback<bool(void)>& make_context_current)
+ const gpu_vda_helpers::GetGLES2DecoderCb& get_gles2_decoder_cb,
+ const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb)
: client_(NULL),
- make_context_current_(make_context_current),
+ make_context_current_cb_(make_context_current_cb),
+ get_gles2_decoder_cb_(get_gles2_decoder_cb),
codec_(media::kCodecH264),
is_encrypted_(false),
needs_protected_surface_(false),
state_(NO_ERROR),
picturebuffers_requested_(false),
- gl_decoder_(decoder),
cdm_registration_id_(0),
pending_input_buf_index_(-1),
error_sequence_token_(0),
@@ -247,7 +247,9 @@ AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
if (UseDeferredRenderingStrategy()) {
// TODO(liberato, watk): Figure out what we want to do about zero copy for
// fullscreen external SurfaceView in WebView. http://crbug.com/582170.
- DCHECK(!gl_decoder_->GetContextGroup()->mailbox_manager()->UsesSync());
+ auto gles_decoder = get_gles2_decoder_cb_.Run();
kcwu 2016/03/01 10:25:06 However about moving those callbacks invoking to I
Pawel Osciak 2016/03/02 07:17:11 Done.
+ DCHECK(gles_decoder);
+ DCHECK(!gles_decoder->GetContextGroup()->mailbox_manager()->UsesSync());
DVLOG(1) << __FUNCTION__ << ", using deferred rendering strategy.";
strategy_.reset(new AndroidDeferredRenderingBackingStrategy(this));
} else {
@@ -304,12 +306,12 @@ bool AndroidVideoDecodeAccelerator::Initialize(const Config& config,
}
}
- if (!make_context_current_.Run()) {
+ if (!make_context_current_cb_.Run()) {
LOG(ERROR) << "Failed to make this decoder's GL context current.";
return false;
}
- if (!gl_decoder_) {
+ if (!GetGlDecoder()) {
LOG(ERROR) << "Failed to get gles2 decoder instance.";
return false;
}
@@ -676,7 +678,7 @@ void AndroidVideoDecodeAccelerator::SendDecodedFrameToClient(
DCHECK(!free_picture_ids_.empty());
TRACE_EVENT0("media", "AVDA::SendDecodedFrameToClient");
- if (!make_context_current_.Run()) {
+ if (!make_context_current_cb_.Run()) {
POST_ERROR(PLATFORM_FAILURE, "Failed to make the GL context current.");
return;
}
@@ -936,7 +938,7 @@ void AndroidVideoDecodeAccelerator::Reset() {
void AndroidVideoDecodeAccelerator::Destroy() {
DCHECK(thread_checker_.CalledOnValidThread());
- bool have_context = make_context_current_.Run();
+ bool have_context = make_context_current_cb_.Run();
if (!have_context)
LOG(WARNING) << "Failed make GL context current for Destroy, continuing.";
@@ -956,7 +958,9 @@ void AndroidVideoDecodeAccelerator::Destroy() {
delete this;
}
-bool AndroidVideoDecodeAccelerator::CanDecodeOnIOThread() {
+bool AndroidVideoDecodeAccelerator::TryInitializeDecodeOnSeparateThread(
+ const base::WeakPtr<Client>& decode_client,
+ const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
return false;
}
@@ -971,7 +975,7 @@ const base::ThreadChecker& AndroidVideoDecodeAccelerator::ThreadChecker()
base::WeakPtr<gpu::gles2::GLES2Decoder>
AndroidVideoDecodeAccelerator::GetGlDecoder() const {
- return gl_decoder_;
+ return get_gles2_decoder_cb_.Run();
}
void AndroidVideoDecodeAccelerator::OnFrameAvailable() {

Powered by Google App Engine
This is Rietveld 408576698