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

Side by Side Diff: media/capture/service/mojo_video_frame.h

Issue 1699553002: Mojo Video Capture service in media/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added missing BUILD deps 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAPTURE_SERVICE_MOJO_VIDEO_FRAME_H_
6 #define MEDIA_CAPTURE_SERVICE_MOJO_VIDEO_FRAME_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h"
10 #include "media/base/video_frame.h"
11 #include "mojo/public/cpp/system/buffer.h"
12
13 namespace gfx {
14 class Size;
15 }
16
17 namespace media {
18
19 // A derived class of media::VideoFrame holding a mojo::SharedBuffer which is
20 // mapped on constructor and remains so for the lifetime of the MojoVideoFrame.
21 // The underlying VideoFrame uses this SharedBuffer as storage. MojoVideoFrames
22 // frames are ref-counted, always I420, and coded_size() == natural_size() ==
23 // visible_rect().
24 class MojoVideoFrame : public media::VideoFrame {
25 public:
26 // Creates and maps a MojoVideoFrame or returns nullptr.
27 static scoped_refptr<MojoVideoFrame> CreateMojoVideoFrame(
28 const gfx::Size& dimensions,
29 base::TimeDelta timestamp);
30
31 mojo::SharedBufferHandle handle() { return shared_buffer_.handle.get(); }
32 size_t mapped_size() const { return shared_buffer_size_; }
33
34 private:
35 explicit MojoVideoFrame(const gfx::Size& dimensions,
36 base::TimeDelta timestamp);
37 ~MojoVideoFrame() override;
38
39 // Maps |shared_buffer_| or returns false.
40 bool Init();
41
42 const size_t shared_buffer_size_;
43 const mojo::SharedBuffer shared_buffer_;
44 };
45
46 } // namespace media
47
48 #endif // MEDIA_CAPTURE_SERVICE_MOJO_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698