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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 : buffer_pool_(std::move(buffer_pool)) {} | 224 : buffer_pool_(std::move(buffer_pool)) {} |
225 | 225 |
226 void SetBufferHold(int buffer_id) override { | 226 void SetBufferHold(int buffer_id) override { |
227 buffer_pool_->HoldForConsumers(buffer_id, 1); | 227 buffer_pool_->HoldForConsumers(buffer_id, 1); |
228 } | 228 } |
229 | 229 |
230 void ReleaseBufferHold(int buffer_id) override { | 230 void ReleaseBufferHold(int buffer_id) override { |
231 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); | 231 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); |
232 } | 232 } |
233 | 233 |
234 mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) override { | |
235 return buffer_pool_->GetHandleForTransit(buffer_id); | |
236 } | |
237 | |
238 private: | 234 private: |
239 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_; | 235 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_; |
240 }; | 236 }; |
241 | 237 |
242 // Class used for queuing request for starting a device. | 238 // Class used for queuing request for starting a device. |
243 class VideoCaptureManager::CaptureDeviceStartRequest { | 239 class VideoCaptureManager::CaptureDeviceStartRequest { |
244 public: | 240 public: |
245 CaptureDeviceStartRequest(int serial_id, | 241 CaptureDeviceStartRequest(int serial_id, |
246 media::VideoCaptureSessionId session_id, | 242 media::VideoCaptureSessionId session_id, |
247 const media::VideoCaptureParams& params); | 243 const media::VideoCaptureParams& params); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 // First client starts the device. | 746 // First client starts the device. |
751 if (!entry->video_capture_controller.HasActiveClient() && | 747 if (!entry->video_capture_controller.HasActiveClient() && |
752 !entry->video_capture_controller.HasPausedClient()) { | 748 !entry->video_capture_controller.HasPausedClient()) { |
753 DVLOG(1) << "VideoCaptureManager starting device (type = " | 749 DVLOG(1) << "VideoCaptureManager starting device (type = " |
754 << entry->stream_type << ", id = " << entry->id << ")"; | 750 << entry->stream_type << ", id = " << entry->id << ")"; |
755 QueueStartDevice(session_id, entry, params); | 751 QueueStartDevice(session_id, entry, params); |
756 } | 752 } |
757 // Run the callback first, as AddClient() may trigger OnFrameInfo(). | 753 // Run the callback first, as AddClient() may trigger OnFrameInfo(). |
758 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread()); | 754 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread()); |
759 entry->video_capture_controller.AddClient(client_id, client_handler, | 755 entry->video_capture_controller.AddClient(client_id, client_handler, |
760 session_id, params); | 756 session_id, params); |
761 } | 757 } |
762 | 758 |
763 void VideoCaptureManager::StopCaptureForClient( | 759 void VideoCaptureManager::StopCaptureForClient( |
764 VideoCaptureController* controller, | 760 VideoCaptureController* controller, |
765 VideoCaptureControllerID client_id, | 761 VideoCaptureControllerID client_id, |
766 VideoCaptureControllerEventHandler* client_handler, | 762 VideoCaptureControllerEventHandler* client_handler, |
767 bool aborted_due_to_error) { | 763 bool aborted_due_to_error) { |
768 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 764 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
769 DCHECK(controller); | 765 DCHECK(controller); |
770 DCHECK(client_handler); | 766 DCHECK(client_handler); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 if (!device_in_queue) { | 1324 if (!device_in_queue) { |
1329 // Session ID is only valid for Screen capture. So we can fake it to | 1325 // Session ID is only valid for Screen capture. So we can fake it to |
1330 // resume video capture devices here. | 1326 // resume video capture devices here. |
1331 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1327 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
1332 } | 1328 } |
1333 } | 1329 } |
1334 } | 1330 } |
1335 #endif // defined(OS_ANDROID) | 1331 #endif // defined(OS_ANDROID) |
1336 | 1332 |
1337 } // namespace content | 1333 } // namespace content |
OLD | NEW |