Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_ | |
| 6 #define COMPONENTS_VIDEO_CAPTURE_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 "media/base/video_types.h" | |
| 12 #include "mojo/public/cpp/system/buffer.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 class Size; | |
| 16 } | |
| 17 | |
| 18 namespace video_capture { | |
| 19 | |
| 20 // A derived class of media::VideoFrame holding a mojo::SharedBuffer which is | |
| 21 // mapped on constructor and remains so for the lifetime of the MojoVideoFrame. | |
| 22 // The underlying VideoFrame uses this SharedBuffer as storage. MojoVideoFrames | |
| 23 // frames are ref-counted, always I420, and coded_size() == natural_size() == | |
| 24 // visible_rect(). | |
| 25 class MojoVideoFrame : public media::VideoFrame { | |
| 26 public: | |
| 27 static scoped_refptr<MojoVideoFrame> CreateMojoVideoFrame( | |
| 28 const gfx::Size& dimensions, | |
| 29 base::TimeDelta timestamp); | |
| 30 | |
| 31 explicit MojoVideoFrame(const gfx::Size& dimensions, | |
| 32 base::TimeDelta timestamp); | |
|
emircan
2016/02/16 17:45:48
Should this be private since we have the static ca
mcasas
2016/02/16 23:17:21
Done.
| |
| 33 | |
| 34 mojo::SharedBufferHandle handle() { return shared_buffer_.handle.get(); } | |
| 35 size_t mapped_size() const { return shared_buffer_size_; } | |
| 36 | |
| 37 private: | |
| 38 ~MojoVideoFrame() override; | |
| 39 | |
| 40 const size_t shared_buffer_size_; | |
| 41 const mojo::SharedBuffer shared_buffer_; | |
| 42 }; | |
| 43 | |
| 44 } // namespace video_capture | |
| 45 | |
| 46 #endif // COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_ | |
| OLD | NEW |