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

Unified Diff: ui/gl/gl_image_io_surface.mm

Issue 1861923002: Mac h264: Retain CVPixelBuffer inside GLImageIOSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix assert Created 4 years, 8 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 | « ui/gl/gl_image_io_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_io_surface.mm
diff --git a/ui/gl/gl_image_io_surface.mm b/ui/gl/gl_image_io_surface.mm
index 3059333cc8896feb96c15f2b4147e3e927a3f417..d94a60a5e217d4a272b06e477de47da5672d7395 100644
--- a/ui/gl/gl_image_io_surface.mm
+++ b/ui/gl/gl_image_io_surface.mm
@@ -222,6 +222,23 @@ bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface,
return true;
}
+bool GLImageIOSurface::InitializeWithCVPixelBuffer(
+ CVPixelBufferRef cv_pixel_buffer,
+ gfx::GenericSharedMemoryId io_surface_id,
+ BufferFormat format) {
+ IOSurfaceRef io_surface = CVPixelBufferGetIOSurface(cv_pixel_buffer);
+ if (!io_surface) {
+ LOG(ERROR) << "Can't init GLImage from CVPixelBuffer with no IOSurface";
+ return false;
+ }
+
+ if (!Initialize(io_surface, io_surface_id, format))
+ return false;
+
+ cv_pixel_buffer_.reset(cv_pixel_buffer, base::scoped_policy::RETAIN);
+ return true;
+}
+
void GLImageIOSurface::Destroy(bool have_context) {
DCHECK(thread_checker_.CalledOnValidThread());
if (have_context && framebuffer_) {
@@ -233,6 +250,7 @@ void GLImageIOSurface::Destroy(bool have_context) {
glDeleteTextures(2, yuv_textures_);
}
io_surface_.reset();
+ cv_pixel_buffer_.reset();
}
gfx::Size GLImageIOSurface::GetSize() {
@@ -409,6 +427,10 @@ base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() {
return io_surface_;
}
+base::ScopedCFTypeRef<CVPixelBufferRef> GLImageIOSurface::cv_pixel_buffer() {
+ return cv_pixel_buffer_;
+}
+
// static
void GLImageIOSurface::SetLayerForWidget(gfx::AcceleratedWidget widget,
CALayer* layer) {
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698