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

Unified Diff: components/video_capture/mojo_video_frame.h

Issue 1637793004: [WIP] Mojo Video Capture thingy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: heave!! Created 4 years, 10 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: components/video_capture/mojo_video_frame.h
diff --git a/components/video_capture/mojo_video_frame.h b/components/video_capture/mojo_video_frame.h
new file mode 100644
index 0000000000000000000000000000000000000000..a91762ee86b0a2c0d2c510b46937cdd5c704418d
--- /dev/null
+++ b/components/video_capture/mojo_video_frame.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_
+#define COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
+#include "media/base/video_frame.h"
+#include "media/base/video_types.h"
+#include "mojo/public/cpp/system/buffer.h"
+
+namespace gfx {
+class Size;
+}
+
+namespace video_capture {
+
+// A derived class of media::VideoFrame holding a mojo::SharedBuffer which is
+// mapped on constructor and remains so for the lifetime of the MojoVideoFrame.
+// The underlying VideoFrame uses this SharedBuffer as storage. MojoVideoFrames
+// frames are ref-counted, always I420, and coded_size() == natural_size() ==
+// visible_rect().
+class MojoVideoFrame : public media::VideoFrame {
+ public:
+ static scoped_refptr<MojoVideoFrame> CreateMojoVideoFrame(
+ const gfx::Size& dimensions,
+ base::TimeDelta timestamp);
+
+ explicit MojoVideoFrame(const gfx::Size& dimensions,
+ base::TimeDelta timestamp);
+
+ mojo::SharedBufferHandle handle() { return shared_buffer_.handle.get(); }
+ size_t mapped_size() const { return shared_buffer_size_; }
+
+ private:
+ ~MojoVideoFrame() override;
+
+ const size_t shared_buffer_size_;
+ const mojo::SharedBuffer shared_buffer_;
+};
+
+} // namespace video_capture
+
+#endif // COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_

Powered by Google App Engine
This is Rietveld 408576698