| 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 #include "services/video_capture/receiver_mojo_to_media_adapter.h" |
| 6 |
| 7 #include "media/mojo/common/media_type_converters.h" |
| 8 #include "media/mojo/common/mojo_shared_buffer_video_frame.h" |
| 9 |
| 10 namespace video_capture { |
| 11 |
| 12 ReceiverMojoToMediaAdapter::ReceiverMojoToMediaAdapter( |
| 13 mojom::VideoFrameReceiverPtr receiver) |
| 14 : receiver_(std::move(receiver)) {} |
| 15 |
| 16 ReceiverMojoToMediaAdapter::~ReceiverMojoToMediaAdapter() = default; |
| 17 |
| 18 void ReceiverMojoToMediaAdapter::OnIncomingCapturedVideoFrame( |
| 19 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, |
| 20 const scoped_refptr<media::VideoFrame>& frame) { |
| 21 // O: |frame| should already be backed by a MojoSharedBufferVideoFrame |
| 22 // assuming we have used the correct buffer factory with the pool. |
| 23 auto video_frame_ptr = media::mojom::VideoFrame::From(frame); |
| 24 receiver_->OnIncomingCapturedVideoFrame(std::move(video_frame_ptr)); |
| 25 } |
| 26 |
| 27 void ReceiverMojoToMediaAdapter::OnError() { |
| 28 receiver_->OnError(); |
| 29 } |
| 30 |
| 31 void ReceiverMojoToMediaAdapter::OnLog(const std::string& message) { |
| 32 receiver_->OnLog(message); |
| 33 } |
| 34 |
| 35 void ReceiverMojoToMediaAdapter::OnBufferDestroyed(int buffer_id_to_drop) { |
| 36 // Nothing to do here. |
| 37 // 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 |
| 39 // no longer going to reuse/resurrect. |
| 40 // In the world of Mojo, we do not need to share buffers explicitly. |
| 41 } |
| 42 |
| 43 } // namespace video_capture |
| OLD | NEW |