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

Unified Diff: media/video/gpu_memory_buffer_video_frame_pool.cc

Issue 1823683002: media: GpuMemoryBufferVideoFramePool uses BindToCurrentLoop() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rollback unrelated change Created 4 years, 9 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
« no previous file with comments | « no previous file | media/video/gpu_memory_buffer_video_frame_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/gpu_memory_buffer_video_frame_pool.cc
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc
index 28cb1f6968049174f9e2952e261e16bd771aa7bd..777a1fc279892fa6afdf8db4071094bdc4469f80 100644
--- a/media/video/gpu_memory_buffer_video_frame_pool.cc
+++ b/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -24,6 +24,7 @@
#include "base/trace_event/trace_event.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface.h"
+#include "media/base/bind_to_current_loop.h"
#include "media/renderers/gpu_video_accelerator_factories.h"
#include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/buffer_format_util.h"
@@ -139,14 +140,10 @@ class GpuMemoryBufferVideoFramePool::PoolImpl
// Callback called when a VideoFrame generated with GetFrameResources is no
// longer referenced.
- // This could be called by any thread.
+ // This must be called on the thread where |media_task_runner_| is current.
void MailboxHoldersReleased(FrameResources* frame_resources,
const gpu::SyncToken& sync_token);
- // Return frame resources to the pool. This has to be called on the thread
- // where |media_task_runner_| is current.
- void ReturnFrameResources(FrameResources* frame_resources);
-
// Delete resources. This has to be called on the thread where |task_runner|
// is current.
static void DeleteFrameResources(GpuVideoAcceleratorFactories* gpu_factories,
@@ -594,8 +591,8 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
scoped_refptr<VideoFrame> frame;
- auto release_mailbox_callback =
- base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources);
+ auto release_mailbox_callback = BindToCurrentLoop(
+ base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources));
// Create the VideoFrame backed by native textures.
gfx::Size visible_size = video_frame->visible_rect().size();
@@ -736,19 +733,12 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::DeleteFrameResources(
}
}
-// Called when a VideoFrame is no longer references.
+// Called when a VideoFrame is no longer referenced.
+// Put back the resources in the pool.
void GpuMemoryBufferVideoFramePool::PoolImpl::MailboxHoldersReleased(
FrameResources* frame_resources,
- const gpu::SyncToken& sync_token) {
- // Return the resource on the media thread.
- media_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&PoolImpl::ReturnFrameResources, this, frame_resources));
-}
-
-// Put back the resources in the pool.
-void GpuMemoryBufferVideoFramePool::PoolImpl::ReturnFrameResources(
- FrameResources* frame_resources) {
+ const gpu::SyncToken& release_sync_token) {
+ DCHECK(media_task_runner_->BelongsToCurrentThread());
auto it = std::find(resources_pool_.begin(), resources_pool_.end(),
frame_resources);
DCHECK(it != resources_pool_.end());
« no previous file with comments | « no previous file | media/video/gpu_memory_buffer_video_frame_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698