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 "mojo/public/cpp/bindings/strong_binding.h" |
| 8 |
| 9 namespace { |
| 10 |
| 11 class ScopedAccessPermissionMediaToMojoAdapter |
| 12 : public video_capture::mojom::ScopedAccessPermission { |
| 13 public: |
| 14 ScopedAccessPermissionMediaToMojoAdapter( |
| 15 std::unique_ptr< |
| 16 media::VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> |
| 17 access_permission) |
| 18 : access_permission_(std::move(access_permission)) {} |
| 19 |
| 20 private: |
| 21 std::unique_ptr< |
| 22 media::VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> |
| 23 access_permission_; |
| 24 }; |
| 25 |
| 26 } // anonymous namespace |
| 27 |
7 namespace video_capture { | 28 namespace video_capture { |
8 | 29 |
9 ReceiverMojoToMediaAdapter::ReceiverMojoToMediaAdapter( | 30 ReceiverMojoToMediaAdapter::ReceiverMojoToMediaAdapter( |
10 mojom::ReceiverPtr receiver) | 31 mojom::ReceiverPtr receiver) |
11 : receiver_(std::move(receiver)) {} | 32 : receiver_(std::move(receiver)) {} |
12 | 33 |
13 ReceiverMojoToMediaAdapter::~ReceiverMojoToMediaAdapter() = default; | 34 ReceiverMojoToMediaAdapter::~ReceiverMojoToMediaAdapter() = default; |
14 | 35 |
15 void ReceiverMojoToMediaAdapter::OnNewBufferHandle( | 36 void ReceiverMojoToMediaAdapter::OnNewBufferHandle( |
16 int buffer_id, | 37 int buffer_id, |
17 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer::HandleProvider> | 38 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer::HandleProvider> |
18 handle_provider) { | 39 handle_provider) { |
19 NOTIMPLEMENTED(); | 40 receiver_->OnNewBufferHandle( |
| 41 buffer_id, handle_provider->GetHandleForInterProcessTransit()); |
20 } | 42 } |
21 | 43 |
22 void ReceiverMojoToMediaAdapter::OnFrameReadyInBuffer( | 44 void ReceiverMojoToMediaAdapter::OnFrameReadyInBuffer( |
23 int buffer_id, | 45 int buffer_id, |
24 int frame_feedback_id, | 46 int frame_feedback_id, |
25 std::unique_ptr< | 47 std::unique_ptr< |
26 media::VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> | 48 media::VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> |
27 buffer_usage_reservation, | 49 access_permission, |
28 media::mojom::VideoFrameInfoPtr frame_info) { | 50 media::mojom::VideoFrameInfoPtr frame_info) { |
29 NOTIMPLEMENTED(); | 51 mojom::ScopedAccessPermissionPtr access_permission_proxy; |
| 52 mojo::MakeStrongBinding<mojom::ScopedAccessPermission>( |
| 53 base::MakeUnique<ScopedAccessPermissionMediaToMojoAdapter>( |
| 54 std::move(access_permission)), |
| 55 mojo::MakeRequest(&access_permission_proxy)); |
| 56 receiver_->OnFrameReadyInBuffer(buffer_id, frame_feedback_id, |
| 57 std::move(access_permission_proxy), |
| 58 std::move(frame_info)); |
| 59 } |
| 60 |
| 61 void ReceiverMojoToMediaAdapter::OnBufferRetired(int buffer_id) { |
| 62 receiver_->OnBufferRetired(buffer_id); |
30 } | 63 } |
31 | 64 |
32 void ReceiverMojoToMediaAdapter::OnError() { | 65 void ReceiverMojoToMediaAdapter::OnError() { |
33 receiver_->OnError(); | 66 receiver_->OnError(); |
34 } | 67 } |
35 | 68 |
36 void ReceiverMojoToMediaAdapter::OnLog(const std::string& message) { | 69 void ReceiverMojoToMediaAdapter::OnLog(const std::string& message) { |
37 receiver_->OnLog(message); | 70 receiver_->OnLog(message); |
38 } | 71 } |
39 | 72 |
40 void ReceiverMojoToMediaAdapter::OnStarted() { | 73 void ReceiverMojoToMediaAdapter::OnStarted() { |
41 receiver_->OnStarted(); | 74 receiver_->OnStarted(); |
42 } | 75 } |
43 | 76 |
44 void ReceiverMojoToMediaAdapter::OnStartedUsingGpuDecode() { | 77 void ReceiverMojoToMediaAdapter::OnStartedUsingGpuDecode() { |
45 NOTIMPLEMENTED(); | 78 receiver_->OnStartedUsingGpuDecode(); |
46 } | |
47 | |
48 void ReceiverMojoToMediaAdapter::OnBufferRetired(int buffer_id) { | |
49 NOTIMPLEMENTED(); | |
50 } | 79 } |
51 | 80 |
52 } // namespace video_capture | 81 } // namespace video_capture |
OLD | NEW |