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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 #if defined(USE_AURA) | 49 #if defined(USE_AURA) |
50 #include "content/browser/media/capture/desktop_capture_device_aura.h" | 50 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
51 #endif | 51 #endif |
52 | 52 |
53 #if defined(OS_ANDROID) | 53 #if defined(OS_ANDROID) |
54 #include "content/browser/media/capture/screen_capture_device_android.h" | 54 #include "content/browser/media/capture/screen_capture_device_android.h" |
55 #endif | 55 #endif |
56 | 56 |
57 #endif // defined(ENABLE_SCREEN_CAPTURE) | 57 #endif // defined(ENABLE_SCREEN_CAPTURE) |
58 | 58 |
59 #if defined(OS_CHROMEOS) | |
60 #include "chromeos/dbus/cras_audio_client.h" | |
61 #include "chromeos/dbus/dbus_thread_manager.h" | |
62 #endif | |
63 | |
59 namespace { | 64 namespace { |
60 | 65 |
61 class VideoFrameConsumerFeedbackObserverOnTaskRunner | 66 class VideoFrameConsumerFeedbackObserverOnTaskRunner |
62 : public media::VideoFrameConsumerFeedbackObserver { | 67 : public media::VideoFrameConsumerFeedbackObserver { |
63 public: | 68 public: |
64 VideoFrameConsumerFeedbackObserverOnTaskRunner( | 69 VideoFrameConsumerFeedbackObserverOnTaskRunner( |
65 media::VideoFrameConsumerFeedbackObserver* observer, | 70 media::VideoFrameConsumerFeedbackObserver* observer, |
66 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 71 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
67 : observer_(observer), task_runner_(std::move(task_runner)) {} | 72 : observer_(observer), task_runner_(std::move(task_runner)) {} |
68 | 73 |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
646 | 651 |
647 std::unique_ptr<VideoCaptureDevice> video_capture_device; | 652 std::unique_ptr<VideoCaptureDevice> video_capture_device; |
648 video_capture_device = | 653 video_capture_device = |
649 video_capture_device_factory_->CreateDevice(descriptor); | 654 video_capture_device_factory_->CreateDevice(descriptor); |
650 | 655 |
651 if (!video_capture_device) { | 656 if (!video_capture_device) { |
652 device_client->OnError(FROM_HERE, "Could not create capture device"); | 657 device_client->OnError(FROM_HERE, "Could not create capture device"); |
653 return nullptr; | 658 return nullptr; |
654 } | 659 } |
655 | 660 |
661 #if defined(OS_CHROMEOS) | |
662 chromeos::DBusThreadManager* thread_manager = | |
663 chromeos::DBusThreadManager::Get(); | |
chfremer
2017/01/17 18:05:55
Independent of the question whether or not this is
shenghao
2017/01/18 10:41:12
Yeah. I totally agree with you on the idea to elim
chfremer
2017/01/18 18:36:10
The observer interface does not need to live in //
| |
664 if (thread_manager != NULL) { | |
665 chromeos::CrasAudioClient* client = thread_manager->GetCrasAudioClient(); | |
666 if (client != NULL) { | |
667 chromeos::CrasAudioClient::VideoFacingMode facing = | |
668 chromeos::CrasAudioClient::VideoFacingMode::NONE; | |
669 switch (descriptor.facing) { | |
chfremer
2017/01/17 18:05:55
In the current version of the code indexed in code
shenghao
2017/01/18 10:41:12
Yes, this CL depends on https://codereview.chromiu
| |
670 case MEDIA_VIDEO_FACING_NONE: | |
671 case NUM_MEDIA_VIDEO_FACING_MODE: | |
672 facing = chromeos::CrasAudioClient::VideoFacingMode::NONE; | |
673 break; | |
674 case MEDIA_VIDEO_FACING_USER: | |
675 facing = chromeos::CrasAudioClient::VideoFacingMode::USER; | |
676 break; | |
677 case MEDIA_VIDEO_FACING_ENVIRONMENT: | |
678 facing = chromeos::CrasAudioClient::VideoFacingMode::ENVIRONMENT; | |
679 break; | |
680 } | |
681 client->OnVideoCaptureStarted(facing); | |
682 } | |
683 } | |
684 #endif | |
685 | |
656 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 686 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
657 return video_capture_device; | 687 return video_capture_device; |
658 } | 688 } |
659 | 689 |
660 std::unique_ptr<media::VideoCaptureDevice> | 690 std::unique_ptr<media::VideoCaptureDevice> |
661 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( | 691 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( |
662 const std::string& id, | 692 const std::string& id, |
663 const media::VideoCaptureParams& params, | 693 const media::VideoCaptureParams& params, |
664 std::unique_ptr<VideoCaptureDevice::Client> device_client) { | 694 std::unique_ptr<VideoCaptureDevice::Client> device_client) { |
665 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); | 695 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1328 if (!device_in_queue) { | 1358 if (!device_in_queue) { |
1329 // Session ID is only valid for Screen capture. So we can fake it to | 1359 // Session ID is only valid for Screen capture. So we can fake it to |
1330 // resume video capture devices here. | 1360 // resume video capture devices here. |
1331 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1361 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
1332 } | 1362 } |
1333 } | 1363 } |
1334 } | 1364 } |
1335 #endif // defined(OS_ANDROID) | 1365 #endif // defined(OS_ANDROID) |
1336 | 1366 |
1337 } // namespace content | 1367 } // namespace content |
OLD | NEW |