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

Unified Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2495753002: Reenable idle suspension of media elements on Windows. (Closed)
Patch Set: add comment Created 4 years, 1 month 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
« no previous file with comments | « media/gpu/dxva_video_decode_accelerator_win.h ('k') | media/gpu/gpu_video_decode_accelerator_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/dxva_video_decode_accelerator_win.cc
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
index e368dd35728060fa7d46dd57dc67eb3a6809b59f..ad24b5a9bd2f993b3ce200963d7c2435dd5c263a 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -486,6 +486,7 @@ DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {}
DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
const GetGLContextCallback& get_gl_context_cb,
const MakeGLContextCurrentCallback& make_context_current_cb,
+ const BindGLImageCallback& bind_image_cb,
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences)
: client_(NULL),
@@ -498,6 +499,7 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
sent_drain_message_(false),
get_gl_context_cb_(get_gl_context_cb),
make_context_current_cb_(make_context_current_cb),
+ bind_image_cb_(bind_image_cb),
codec_(kUnknownVideoCodec),
decoder_thread_("DXVAVideoDecoderThread"),
pending_flush_(false),
@@ -885,6 +887,15 @@ void DXVAVideoDecodeAccelerator::AssignPictureBuffers(
RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer.get(),
"Failed to allocate picture buffer",
PLATFORM_FAILURE, );
+ if (bind_image_cb_) {
+ for (uint32_t client_id : buffers[buffer_index].client_texture_ids()) {
+ // The picture buffer handles the actual binding of its contents to
+ // texture ids. This call just causes the texture manager to hold a
+ // reference to the GLImage as long as either texture exists.
+ bind_image_cb_.Run(client_id, GetTextureTarget(),
+ picture_buffer->gl_image(), true);
+ }
+ }
bool inserted =
output_picture_buffers_
@@ -1936,7 +1947,7 @@ void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) {
kNumPictureBuffers,
provide_nv12_textures ? PIXEL_FORMAT_NV12 : PIXEL_FORMAT_UNKNOWN,
provide_nv12_textures ? 2 : 1, gfx::Size(width, height),
- provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D);
+ GetTextureTarget());
}
}
@@ -2749,4 +2760,9 @@ void DXVAVideoDecodeAccelerator::ConfigChanged(const Config& config) {
base::Unretained(this)));
}
+uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const {
+ bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_;
+ return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
+}
+
} // namespace media
« no previous file with comments | « media/gpu/dxva_video_decode_accelerator_win.h ('k') | media/gpu/gpu_video_decode_accelerator_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698