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