OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/video_capture/receiver_mojo_to_media_adapter.h" | 5 #include "services/video_capture/receiver_mojo_to_media_adapter.h" |
6 | 6 |
7 #include "media/mojo/common/media_type_converters.h" | 7 #include "media/mojo/common/media_type_converters.h" |
8 #include "media/mojo/common/mojo_shared_buffer_video_frame.h" | 8 #include "media/mojo/common/mojo_shared_buffer_video_frame.h" |
9 | 9 |
10 namespace video_capture { | 10 namespace video_capture { |
11 | 11 |
12 ReceiverMojoToMediaAdapter::ReceiverMojoToMediaAdapter( | 12 ReceiverMojoToMediaAdapter::ReceiverMojoToMediaAdapter( |
13 mojom::ReceiverPtr receiver) | 13 mojom::ReceiverPtr receiver) |
14 : receiver_(std::move(receiver)) {} | 14 : receiver_(std::move(receiver)) {} |
15 | 15 |
16 ReceiverMojoToMediaAdapter::~ReceiverMojoToMediaAdapter() = default; | 16 ReceiverMojoToMediaAdapter::~ReceiverMojoToMediaAdapter() = default; |
17 | 17 |
18 void ReceiverMojoToMediaAdapter::OnIncomingCapturedVideoFrame( | 18 void ReceiverMojoToMediaAdapter::OnIncomingCapturedVideoFrame( |
19 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 19 media::VideoCaptureDevice::Client::Buffer buffer, |
20 scoped_refptr<media::VideoFrame> frame) { | 20 scoped_refptr<media::VideoFrame> frame) { |
21 // O: |frame| should already be backed by a MojoSharedBufferVideoFrame | 21 NOTIMPLEMENTED(); |
22 // assuming we have used the correct buffer factory with the pool. | |
23 auto video_frame_ptr = media::mojom::VideoFrame::From(std::move(frame)); | |
24 receiver_->OnIncomingCapturedVideoFrame(std::move(video_frame_ptr)); | |
25 } | 22 } |
26 | 23 |
27 void ReceiverMojoToMediaAdapter::OnError() { | 24 void ReceiverMojoToMediaAdapter::OnError() { |
28 receiver_->OnError(); | 25 receiver_->OnError(); |
29 } | 26 } |
30 | 27 |
31 void ReceiverMojoToMediaAdapter::OnLog(const std::string& message) { | 28 void ReceiverMojoToMediaAdapter::OnLog(const std::string& message) { |
32 receiver_->OnLog(message); | 29 receiver_->OnLog(message); |
33 } | 30 } |
34 | 31 |
35 void ReceiverMojoToMediaAdapter::OnBufferDestroyed(int buffer_id_to_drop) { | 32 void ReceiverMojoToMediaAdapter::OnBufferDestroyed(int buffer_id_to_drop) { |
36 // Nothing to do here. | 33 // Nothing to do here. |
37 // This call is only needed for clients who need to explicitly share buffers | 34 // This call is only needed for clients who need to explicitly share buffers |
38 // with other processes and keep track of which buffers the buffer pool is | 35 // with other processes and keep track of which buffers the buffer pool is |
39 // no longer going to reuse/resurrect. | 36 // no longer going to reuse/resurrect. |
40 // In the world of Mojo, we do not need to share buffers explicitly. | 37 // In the world of Mojo, we do not need to share buffers explicitly. |
41 } | 38 } |
42 | 39 |
43 } // namespace video_capture | 40 } // namespace video_capture |
OLD | NEW |