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

Unified Diff: media/mojo/common/mojo_shared_buffer_video_frame.h

Issue 1769673002: Transfer media::VideoFrame using mojo shared memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
Index: media/mojo/common/mojo_shared_buffer_video_frame.h
diff --git a/media/mojo/common/mojo_shared_buffer_video_frame.h b/media/mojo/common/mojo_shared_buffer_video_frame.h
index d27a85fc7950997b9c6340f5479584838e433793..bc49c3f1d833dfc623b134baac04a04f4a32eb7c 100644
--- a/media/mojo/common/mojo_shared_buffer_video_frame.h
+++ b/media/mojo/common/mojo_shared_buffer_video_frame.h
@@ -15,8 +15,19 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
+namespace mojo {
+template <typename T, typename U>
+struct TypeConverter;
+template <typename T>
+class StructPtr;
+};
+
namespace media {
+namespace interfaces {
+class VideoFrame;
+}
+
// A derived class of media::VideoFrame holding a mojo::SharedBufferHandle
// which is mapped on constructor and remains so for the lifetime of the
// object. These frames are ref-counted.
@@ -53,6 +64,11 @@ class MojoSharedBufferVideoFrame : public VideoFrame {
size_t PlaneOffset(size_t plane) const;
private:
+ // mojo::TypeConverter added as a friend so that MojoSharedBufferVideoFrame
+ // can be transferred across a mojo connection.
+ friend struct mojo::TypeConverter<mojo::StructPtr<interfaces::VideoFrame>,
+ scoped_refptr<VideoFrame>>;
+
MojoSharedBufferVideoFrame(VideoPixelFormat format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
@@ -71,6 +87,14 @@ class MojoSharedBufferVideoFrame : public VideoFrame {
size_t u_offset,
size_t v_offset);
+ // Returns the mojo shared memory handle. This object continues to own the
+ // handle. Caller should call duplicate the handle if they want to keep a
+ // copy of the shared memory.
+ const mojo::SharedBufferHandle& Handle() const;
+
+ // Returns the size of the shared memory.
+ size_t MappedSize() const;
+
mojo::ScopedSharedBufferHandle shared_buffer_handle_;
size_t shared_buffer_size_;
uint8_t* shared_buffer_data_;
« no previous file with comments | « media/mojo/common/media_type_converters_unittest.cc ('k') | media/mojo/common/mojo_shared_buffer_video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698