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

Unified Diff: cc/resources/video_resource_updater.cc

Issue 312803002: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ios build Created 6 years, 5 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 | « cc/resources/video_resource_updater.h ('k') | content/browser/media/capture/desktop_capture_device_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/video_resource_updater.cc
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
index c20d4b143e2ea2e7b388ffd870a28ccb5165b901..731e99aa5c641c55a4195c56d2e8eacc0194cb76 100644
--- a/cc/resources/video_resource_updater.cc
+++ b/cc/resources/video_resource_updater.cc
@@ -18,9 +18,28 @@
namespace cc {
+namespace {
+
const ResourceFormat kYUVResourceFormat = LUMINANCE_8;
const ResourceFormat kRGBResourceFormat = RGBA_8888;
+class SyncPointClientImpl : public media::VideoFrame::SyncPointClient {
+ public:
+ explicit SyncPointClientImpl(gpu::gles2::GLES2Interface* gl) : gl_(gl) {}
+ virtual ~SyncPointClientImpl() {}
+ virtual uint32 InsertSyncPoint() OVERRIDE {
+ return GLC(gl_, gl_->InsertSyncPointCHROMIUM());
+ }
+ virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE {
+ GLC(gl_, gl_->WaitSyncPointCHROMIUM(sync_point));
+ }
+
+ private:
+ gpu::gles2::GLES2Interface* gl_;
+};
+
+} // namespace
+
VideoFrameExternalResources::VideoFrameExternalResources() : type(NONE) {}
VideoFrameExternalResources::~VideoFrameExternalResources() {}
@@ -285,10 +304,21 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
return external_resources;
}
-static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame,
- uint32 sync_point,
- bool lost_resource) {
- frame->AppendReleaseSyncPoint(sync_point);
+// static
+void VideoResourceUpdater::ReturnTexture(
+ base::WeakPtr<VideoResourceUpdater> updater,
+ const scoped_refptr<media::VideoFrame>& video_frame,
+ uint32 sync_point,
+ bool lost_resource) {
+ // TODO(dshwang) this case should be forwarded to the decoder as lost
+ // resource.
+ if (lost_resource || !updater.get())
+ return;
+ // VideoFrame::UpdateReleaseSyncPoint() creates new sync point using the same
+ // GL context which created the given |sync_point|, so discard the
+ // |sync_point|.
+ SyncPointClientImpl client(updater->context_provider_->ContextGL());
+ video_frame->UpdateReleaseSyncPoint(&client);
}
VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
@@ -326,7 +356,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
mailbox_holder->texture_target,
mailbox_holder->sync_point));
external_resources.release_callbacks.push_back(
- base::Bind(&ReturnTexture, video_frame));
+ base::Bind(&ReturnTexture, AsWeakPtr(), video_frame));
return external_resources;
}
« no previous file with comments | « cc/resources/video_resource_updater.h ('k') | content/browser/media/capture/desktop_capture_device_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698