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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 return nullptr; | 647 return nullptr; |
648 } | 648 } |
649 | 649 |
650 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 650 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
651 return video_capture_device; | 651 return video_capture_device; |
652 } | 652 } |
653 | 653 |
654 void VideoCaptureManager::StartCaptureForClient( | 654 void VideoCaptureManager::StartCaptureForClient( |
655 media::VideoCaptureSessionId session_id, | 655 media::VideoCaptureSessionId session_id, |
656 const media::VideoCaptureParams& params, | 656 const media::VideoCaptureParams& params, |
657 base::ProcessHandle client_render_process, | |
658 VideoCaptureControllerID client_id, | 657 VideoCaptureControllerID client_id, |
659 VideoCaptureControllerEventHandler* client_handler, | 658 VideoCaptureControllerEventHandler* client_handler, |
660 const DoneCB& done_cb) { | 659 const DoneCB& done_cb) { |
661 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 660 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
662 DVLOG(1) << __func__ << ", session_id = " << session_id << ", request: " | 661 DVLOG(1) << __func__ << ", session_id = " << session_id << ", request: " |
663 << media::VideoCaptureFormat::ToString(params.requested_format); | 662 << media::VideoCaptureFormat::ToString(params.requested_format); |
664 | 663 |
665 DeviceEntry* entry = GetOrCreateDeviceEntry(session_id, params); | 664 DeviceEntry* entry = GetOrCreateDeviceEntry(session_id, params); |
666 if (!entry) { | 665 if (!entry) { |
667 done_cb.Run(base::WeakPtr<VideoCaptureController>()); | 666 done_cb.Run(base::WeakPtr<VideoCaptureController>()); |
668 return; | 667 return; |
669 } | 668 } |
670 | 669 |
671 DCHECK(entry->video_capture_controller()); | 670 DCHECK(entry->video_capture_controller()); |
672 | 671 |
673 LogVideoCaptureEvent(VIDEO_CAPTURE_START_CAPTURE); | 672 LogVideoCaptureEvent(VIDEO_CAPTURE_START_CAPTURE); |
674 | 673 |
675 // First client starts the device. | 674 // First client starts the device. |
676 if (!entry->video_capture_controller()->HasActiveClient() && | 675 if (!entry->video_capture_controller()->HasActiveClient() && |
677 !entry->video_capture_controller()->HasPausedClient()) { | 676 !entry->video_capture_controller()->HasPausedClient()) { |
678 DVLOG(1) << "VideoCaptureManager starting device (type = " | 677 DVLOG(1) << "VideoCaptureManager starting device (type = " |
679 << entry->stream_type << ", id = " << entry->id << ")"; | 678 << entry->stream_type << ", id = " << entry->id << ")"; |
680 QueueStartDevice(session_id, entry, params); | 679 QueueStartDevice(session_id, entry, params); |
681 } | 680 } |
682 // Run the callback first, as AddClient() may trigger OnFrameInfo(). | 681 // Run the callback first, as AddClient() may trigger OnFrameInfo(). |
683 done_cb.Run(entry->video_capture_controller()->GetWeakPtrForIOThread()); | 682 done_cb.Run(entry->video_capture_controller()->GetWeakPtrForIOThread()); |
684 entry->video_capture_controller()->AddClient( | 683 entry->video_capture_controller()->AddClient( |
685 client_id, client_handler, client_render_process, session_id, params); | 684 client_id, client_handler, session_id, params); |
686 } | 685 } |
687 | 686 |
688 void VideoCaptureManager::StopCaptureForClient( | 687 void VideoCaptureManager::StopCaptureForClient( |
689 VideoCaptureController* controller, | 688 VideoCaptureController* controller, |
690 VideoCaptureControllerID client_id, | 689 VideoCaptureControllerID client_id, |
691 VideoCaptureControllerEventHandler* client_handler, | 690 VideoCaptureControllerEventHandler* client_handler, |
692 bool aborted_due_to_error) { | 691 bool aborted_due_to_error) { |
693 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 692 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
694 DCHECK(controller); | 693 DCHECK(controller); |
695 DCHECK(client_handler); | 694 DCHECK(client_handler); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 if (!device_in_queue) { | 1285 if (!device_in_queue) { |
1287 // Session ID is only valid for Screen capture. So we can fake it to | 1286 // Session ID is only valid for Screen capture. So we can fake it to |
1288 // resume video capture devices here. | 1287 // resume video capture devices here. |
1289 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1288 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
1290 } | 1289 } |
1291 } | 1290 } |
1292 } | 1291 } |
1293 #endif // defined(OS_ANDROID) | 1292 #endif // defined(OS_ANDROID) |
1294 | 1293 |
1295 } // namespace content | 1294 } // namespace content |
OLD | NEW |