OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/media/video_capture_manager.h" | 5 #include "content/browser/renderer_host/media/video_capture_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 : buffer_pool_(std::move(buffer_pool)) {} | 209 : buffer_pool_(std::move(buffer_pool)) {} |
210 | 210 |
211 void SetBufferHold(int buffer_id) override { | 211 void SetBufferHold(int buffer_id) override { |
212 buffer_pool_->HoldForConsumers(buffer_id, 1); | 212 buffer_pool_->HoldForConsumers(buffer_id, 1); |
213 } | 213 } |
214 | 214 |
215 void ReleaseBufferHold(int buffer_id) override { | 215 void ReleaseBufferHold(int buffer_id) override { |
216 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); | 216 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); |
217 } | 217 } |
218 | 218 |
219 mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) override { | |
220 return buffer_pool_->GetHandleForTransit(buffer_id); | |
221 } | |
222 | |
223 private: | 219 private: |
224 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_; | 220 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_; |
225 }; | 221 }; |
226 | 222 |
227 // Class used for queuing request for starting a device. | 223 // Class used for queuing request for starting a device. |
228 class VideoCaptureManager::CaptureDeviceStartRequest { | 224 class VideoCaptureManager::CaptureDeviceStartRequest { |
229 public: | 225 public: |
230 CaptureDeviceStartRequest(int serial_id, | 226 CaptureDeviceStartRequest(int serial_id, |
231 media::VideoCaptureSessionId session_id, | 227 media::VideoCaptureSessionId session_id, |
232 const media::VideoCaptureParams& params); | 228 const media::VideoCaptureParams& params); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 // First client starts the device. | 723 // First client starts the device. |
728 if (!entry->video_capture_controller.HasActiveClient() && | 724 if (!entry->video_capture_controller.HasActiveClient() && |
729 !entry->video_capture_controller.HasPausedClient()) { | 725 !entry->video_capture_controller.HasPausedClient()) { |
730 DVLOG(1) << "VideoCaptureManager starting device (type = " | 726 DVLOG(1) << "VideoCaptureManager starting device (type = " |
731 << entry->stream_type << ", id = " << entry->id << ")"; | 727 << entry->stream_type << ", id = " << entry->id << ")"; |
732 QueueStartDevice(session_id, entry, params); | 728 QueueStartDevice(session_id, entry, params); |
733 } | 729 } |
734 // Run the callback first, as AddClient() may trigger OnFrameInfo(). | 730 // Run the callback first, as AddClient() may trigger OnFrameInfo(). |
735 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread()); | 731 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread()); |
736 entry->video_capture_controller.AddClient(client_id, client_handler, | 732 entry->video_capture_controller.AddClient(client_id, client_handler, |
737 session_id, params); | 733 session_id, params); |
738 } | 734 } |
739 | 735 |
740 void VideoCaptureManager::StopCaptureForClient( | 736 void VideoCaptureManager::StopCaptureForClient( |
741 VideoCaptureController* controller, | 737 VideoCaptureController* controller, |
742 VideoCaptureControllerID client_id, | 738 VideoCaptureControllerID client_id, |
743 VideoCaptureControllerEventHandler* client_handler, | 739 VideoCaptureControllerEventHandler* client_handler, |
744 bool aborted_due_to_error) { | 740 bool aborted_due_to_error) { |
745 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 741 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
746 DCHECK(controller); | 742 DCHECK(controller); |
747 DCHECK(client_handler); | 743 DCHECK(client_handler); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 if (!device_in_queue) { | 1301 if (!device_in_queue) { |
1306 // Session ID is only valid for Screen capture. So we can fake it to | 1302 // Session ID is only valid for Screen capture. So we can fake it to |
1307 // resume video capture devices here. | 1303 // resume video capture devices here. |
1308 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1304 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
1309 } | 1305 } |
1310 } | 1306 } |
1311 } | 1307 } |
1312 #endif // defined(OS_ANDROID) | 1308 #endif // defined(OS_ANDROID) |
1313 | 1309 |
1314 } // namespace content | 1310 } // namespace content |
OLD | NEW |