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

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

Issue 1370443007: Move SurfaceTexture construction to BackingStrategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased. Created 5 years, 3 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 f03328214275b8777cd134881ee0ecea2d3b3711..e0262ad3fd049fed095a666380f30f6df969cfd6 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.cc
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc
@@ -77,7 +77,6 @@ AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
make_context_current_(make_context_current),
codec_(media::kCodecH264),
state_(NO_ERROR),
- surface_texture_id_(0),
picturebuffers_requested_(false),
gl_decoder_(decoder),
strategy_(strategy.Pass()),
@@ -128,20 +127,7 @@ bool AndroidVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
LOG(ERROR) << "Failed to get gles2 decoder instance.";
return false;
}
- glGenTextures(1, &surface_texture_id_);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, surface_texture_id_);
-
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES,
- GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES,
- GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- gl_decoder_->RestoreTextureUnitBindings(0);
- gl_decoder_->RestoreActiveTexture();
-
- surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_);
+ surface_texture_ = strategy_->CreateSurfaceTexture();
if (!ConfigureMediaCodec()) {
LOG(ERROR) << "Failed to create MediaCodec instance.";
@@ -358,7 +344,7 @@ void AndroidVideoDecodeAccelerator::SendCurrentSurfaceToClient(
// Connect the PictureBuffer to the decoded frame, via whatever
// mechanism the strategy likes.
- strategy_->AssignCurrentSurfaceToPictureBuffer(codec_buffer_index, i->second);
+ strategy_->UseCodecBufferForPictureBuffer(codec_buffer_index, i->second);
// TODO(henryhsu): Pass (0, 0) as visible size will cause several test
// cases failed. We should make sure |size_| is coded size or visible size.
@@ -513,15 +499,12 @@ void AndroidVideoDecodeAccelerator::Reset() {
void AndroidVideoDecodeAccelerator::Destroy() {
DCHECK(thread_checker_.CalledOnValidThread());
- strategy_->Cleanup();
-
weak_this_factory_.InvalidateWeakPtrs();
if (media_codec_) {
io_timer_.Stop();
media_codec_->Stop();
}
- if (surface_texture_id_)
- glDeleteTextures(1, &surface_texture_id_);
+ strategy_->Cleanup();
delete this;
}
@@ -538,14 +521,6 @@ const base::ThreadChecker& AndroidVideoDecodeAccelerator::ThreadChecker()
return thread_checker_;
}
-gfx::SurfaceTexture* AndroidVideoDecodeAccelerator::GetSurfaceTexture() const {
- return surface_texture_.get();
-}
-
-uint32 AndroidVideoDecodeAccelerator::GetSurfaceTextureId() const {
- return surface_texture_id_;
-}
-
gpu::gles2::GLES2Decoder* AndroidVideoDecodeAccelerator::GetGlDecoder() const {
return gl_decoder_.get();
}

Powered by Google App Engine
This is Rietveld 408576698