OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "talk/session/media/channelmanager.h" | 28 #include "talk/session/media/channelmanager.h" |
29 | 29 |
30 #ifdef HAVE_CONFIG_H | 30 #ifdef HAVE_CONFIG_H |
31 #include <config.h> | 31 #include <config.h> |
32 #endif | 32 #endif |
33 | 33 |
34 #include <algorithm> | 34 #include <algorithm> |
35 | 35 |
36 #include "talk/app/webrtc/mediacontroller.h" | 36 #include "talk/app/webrtc/mediacontroller.h" |
37 #include "talk/media/base/capturemanager.h" | 37 #include "talk/media/base/capturemanager.h" |
38 #include "talk/media/base/device.h" | |
38 #include "talk/media/base/hybriddataengine.h" | 39 #include "talk/media/base/hybriddataengine.h" |
39 #include "talk/media/base/rtpdataengine.h" | 40 #include "talk/media/base/rtpdataengine.h" |
40 #include "talk/media/base/videocapturer.h" | 41 #include "talk/media/base/videocapturer.h" |
41 #include "talk/media/devices/devicemanager.h" | |
42 #ifdef HAVE_SCTP | 42 #ifdef HAVE_SCTP |
43 #include "talk/media/sctp/sctpdataengine.h" | 43 #include "talk/media/sctp/sctpdataengine.h" |
44 #endif | 44 #endif |
45 #include "talk/session/media/srtpfilter.h" | 45 #include "talk/session/media/srtpfilter.h" |
46 #include "webrtc/base/bind.h" | 46 #include "webrtc/base/bind.h" |
47 #include "webrtc/base/common.h" | 47 #include "webrtc/base/common.h" |
48 #include "webrtc/base/logging.h" | 48 #include "webrtc/base/logging.h" |
49 #include "webrtc/base/sigslotrepeater.h" | 49 #include "webrtc/base/sigslotrepeater.h" |
50 #include "webrtc/base/stringencode.h" | 50 #include "webrtc/base/stringencode.h" |
51 #include "webrtc/base/stringutils.h" | 51 #include "webrtc/base/stringutils.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
71 static DataEngineInterface* ConstructDataEngine() { | 71 static DataEngineInterface* ConstructDataEngine() { |
72 #ifdef HAVE_SCTP | 72 #ifdef HAVE_SCTP |
73 return new HybridDataEngine(new RtpDataEngine(), new SctpDataEngine()); | 73 return new HybridDataEngine(new RtpDataEngine(), new SctpDataEngine()); |
74 #else | 74 #else |
75 return new RtpDataEngine(); | 75 return new RtpDataEngine(); |
76 #endif | 76 #endif |
77 } | 77 } |
78 | 78 |
79 ChannelManager::ChannelManager(MediaEngineInterface* me, | 79 ChannelManager::ChannelManager(MediaEngineInterface* me, |
80 DataEngineInterface* dme, | 80 DataEngineInterface* dme, |
81 DeviceManagerInterface* dm, | |
82 CaptureManager* cm, | 81 CaptureManager* cm, |
83 rtc::Thread* worker_thread) { | 82 rtc::Thread* worker_thread) { |
84 Construct(me, dme, dm, cm, worker_thread); | 83 Construct(me, dme, cm, worker_thread); |
85 } | 84 } |
86 | 85 |
87 ChannelManager::ChannelManager(MediaEngineInterface* me, | 86 ChannelManager::ChannelManager(MediaEngineInterface* me, |
88 DeviceManagerInterface* dm, | |
89 rtc::Thread* worker_thread) { | 87 rtc::Thread* worker_thread) { |
90 Construct(me, | 88 Construct(me, |
91 ConstructDataEngine(), | 89 ConstructDataEngine(), |
92 dm, | |
93 new CaptureManager(), | 90 new CaptureManager(), |
94 worker_thread); | 91 worker_thread); |
95 } | 92 } |
96 | 93 |
97 void ChannelManager::Construct(MediaEngineInterface* me, | 94 void ChannelManager::Construct(MediaEngineInterface* me, |
98 DataEngineInterface* dme, | 95 DataEngineInterface* dme, |
99 DeviceManagerInterface* dm, | |
100 CaptureManager* cm, | 96 CaptureManager* cm, |
101 rtc::Thread* worker_thread) { | 97 rtc::Thread* worker_thread) { |
102 media_engine_.reset(me); | 98 media_engine_.reset(me); |
103 data_media_engine_.reset(dme); | 99 data_media_engine_.reset(dme); |
104 device_manager_.reset(dm); | |
105 capture_manager_.reset(cm); | 100 capture_manager_.reset(cm); |
106 initialized_ = false; | 101 initialized_ = false; |
107 main_thread_ = rtc::Thread::Current(); | 102 main_thread_ = rtc::Thread::Current(); |
108 worker_thread_ = worker_thread; | 103 worker_thread_ = worker_thread; |
109 // Get the default audio options from the media engine. | 104 // Get the default audio options from the media engine. |
110 audio_options_ = media_engine_->GetAudioOptions(); | 105 audio_options_ = media_engine_->GetAudioOptions(); |
111 audio_in_device_ = DeviceManagerInterface::kDefaultDeviceName; | |
112 audio_out_device_ = DeviceManagerInterface::kDefaultDeviceName; | |
113 audio_delay_offset_ = kDefaultAudioDelayOffset; | 106 audio_delay_offset_ = kDefaultAudioDelayOffset; |
114 audio_output_volume_ = kNotSetOutputVolume; | 107 audio_output_volume_ = kNotSetOutputVolume; |
115 local_renderer_ = NULL; | 108 local_renderer_ = NULL; |
116 capturing_ = false; | 109 capturing_ = false; |
117 enable_rtx_ = false; | 110 enable_rtx_ = false; |
118 | 111 |
119 // Init the device manager immediately, and set up our default video device. | |
120 SignalDevicesChange.repeat(device_manager_->SignalDevicesChange); | |
121 device_manager_->Init(); | |
122 | |
123 capture_manager_->SignalCapturerStateChange.connect( | 112 capture_manager_->SignalCapturerStateChange.connect( |
124 this, &ChannelManager::OnVideoCaptureStateChange); | 113 this, &ChannelManager::OnVideoCaptureStateChange); |
125 } | 114 } |
126 | 115 |
127 ChannelManager::~ChannelManager() { | 116 ChannelManager::~ChannelManager() { |
128 if (initialized_) { | 117 if (initialized_) { |
129 Terminate(); | 118 Terminate(); |
130 // If srtp is initialized (done by the Channel) then we must call | 119 // If srtp is initialized (done by the Channel) then we must call |
131 // srtp_shutdown to free all crypto kernel lists. But we need to make sure | 120 // srtp_shutdown to free all crypto kernel lists. But we need to make sure |
132 // shutdown always called at the end, after channels are destroyed. | 121 // shutdown always called at the end, after channels are destroyed. |
(...skipping 16 matching lines...) Expand all Loading... | |
149 if (!initialized_) { | 138 if (!initialized_) { |
150 enable_rtx_ = enable; | 139 enable_rtx_ = enable; |
151 return true; | 140 return true; |
152 } else { | 141 } else { |
153 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; | 142 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; |
154 return false; | 143 return false; |
155 } | 144 } |
156 } | 145 } |
157 | 146 |
158 int ChannelManager::GetCapabilities() { | 147 int ChannelManager::GetCapabilities() { |
159 return media_engine_->GetCapabilities() & device_manager_->GetCapabilities(); | 148 return media_engine_->GetCapabilities(); |
160 } | 149 } |
161 | 150 |
162 void ChannelManager::GetSupportedAudioCodecs( | 151 void ChannelManager::GetSupportedAudioCodecs( |
163 std::vector<AudioCodec>* codecs) const { | 152 std::vector<AudioCodec>* codecs) const { |
164 codecs->clear(); | 153 codecs->clear(); |
165 | 154 |
166 for (std::vector<AudioCodec>::const_iterator it = | 155 for (std::vector<AudioCodec>::const_iterator it = |
167 media_engine_->audio_codecs().begin(); | 156 media_engine_->audio_codecs().begin(); |
168 it != media_engine_->audio_codecs().end(); ++it) { | 157 it != media_engine_->audio_codecs().end(); ++it) { |
169 codecs->push_back(*it); | 158 codecs->push_back(*it); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 if (!initialized_) { | 209 if (!initialized_) { |
221 return false; | 210 return false; |
222 } | 211 } |
223 | 212 |
224 // Now that we're initialized, apply any stored preferences. A preferred | 213 // Now that we're initialized, apply any stored preferences. A preferred |
225 // device might have been unplugged. In this case, we fallback to the | 214 // device might have been unplugged. In this case, we fallback to the |
226 // default device but keep the user preferences. The preferences are | 215 // default device but keep the user preferences. The preferences are |
227 // changed only when the Javascript FE changes them. | 216 // changed only when the Javascript FE changes them. |
228 const std::string preferred_audio_in_device = audio_in_device_; | 217 const std::string preferred_audio_in_device = audio_in_device_; |
229 const std::string preferred_audio_out_device = audio_out_device_; | 218 const std::string preferred_audio_out_device = audio_out_device_; |
230 const std::string preferred_camera_device = camera_device_; | 219 audio_in_device_ = ""; |
231 Device device; | 220 audio_out_device_ = ""; |
232 if (!device_manager_->GetAudioInputDevice(audio_in_device_, &device)) { | |
233 LOG(LS_WARNING) << "The preferred microphone '" << audio_in_device_ | |
234 << "' is unavailable. Fall back to the default."; | |
235 audio_in_device_ = DeviceManagerInterface::kDefaultDeviceName; | |
236 } | |
237 if (!device_manager_->GetAudioOutputDevice(audio_out_device_, &device)) { | |
238 LOG(LS_WARNING) << "The preferred speaker '" << audio_out_device_ | |
239 << "' is unavailable. Fall back to the default."; | |
240 audio_out_device_ = DeviceManagerInterface::kDefaultDeviceName; | |
241 } | |
242 if (!device_manager_->GetVideoCaptureDevice(camera_device_, &device)) { | |
243 if (!camera_device_.empty()) { | |
244 LOG(LS_WARNING) << "The preferred camera '" << camera_device_ | |
245 << "' is unavailable. Fall back to the default."; | |
246 } | |
247 camera_device_ = DeviceManagerInterface::kDefaultDeviceName; | |
248 } | |
249 | |
250 if (!SetAudioOptions(audio_in_device_, audio_out_device_, | 221 if (!SetAudioOptions(audio_in_device_, audio_out_device_, |
251 audio_options_, audio_delay_offset_)) { | 222 audio_options_, audio_delay_offset_)) { |
252 LOG(LS_WARNING) << "Failed to SetAudioOptions with" | 223 LOG(LS_WARNING) << "Failed to SetAudioOptions with" |
253 << " microphone: " << audio_in_device_ | 224 << " microphone: " << audio_in_device_ |
254 << " speaker: " << audio_out_device_ | 225 << " speaker: " << audio_out_device_ |
255 << " options: " << audio_options_.ToString() | 226 << " options: " << audio_options_.ToString() |
256 << " delay: " << audio_delay_offset_; | 227 << " delay: " << audio_delay_offset_; |
257 } | 228 } |
258 | 229 |
259 // If audio_output_volume_ has been set via SetOutputVolume(), set the | 230 // If audio_output_volume_ has been set via SetOutputVolume(), set the |
260 // audio output volume of the engine. | 231 // audio output volume of the engine. |
261 if (kNotSetOutputVolume != audio_output_volume_ && | 232 if (kNotSetOutputVolume != audio_output_volume_ && |
262 !SetOutputVolume(audio_output_volume_)) { | 233 !SetOutputVolume(audio_output_volume_)) { |
263 LOG(LS_WARNING) << "Failed to SetOutputVolume to " | 234 LOG(LS_WARNING) << "Failed to SetOutputVolume to " |
264 << audio_output_volume_; | 235 << audio_output_volume_; |
265 } | 236 } |
266 if (!SetCaptureDevice(camera_device_) && !camera_device_.empty()) { | |
267 LOG(LS_WARNING) << "Failed to SetCaptureDevice with camera: " | |
268 << camera_device_; | |
269 } | |
270 | 237 |
271 // Restore the user preferences. | 238 // Restore the user preferences. |
272 audio_in_device_ = preferred_audio_in_device; | 239 audio_in_device_ = preferred_audio_in_device; |
273 audio_out_device_ = preferred_audio_out_device; | 240 audio_out_device_ = preferred_audio_out_device; |
274 camera_device_ = preferred_camera_device; | |
275 | 241 |
276 // Now apply the default video codec that has been set earlier. | 242 // Now apply the default video codec that has been set earlier. |
277 if (default_video_encoder_config_.max_codec.id != 0) { | 243 if (default_video_encoder_config_.max_codec.id != 0) { |
278 SetDefaultVideoEncoderConfig(default_video_encoder_config_); | 244 SetDefaultVideoEncoderConfig(default_video_encoder_config_); |
279 } | 245 } |
280 | 246 |
281 return initialized_; | 247 return initialized_; |
282 } | 248 } |
283 | 249 |
284 bool ChannelManager::InitMediaEngine_w() { | 250 bool ChannelManager::InitMediaEngine_w() { |
(...skipping 18 matching lines...) Expand all Loading... | |
303 | 269 |
304 void ChannelManager::Terminate_w() { | 270 void ChannelManager::Terminate_w() { |
305 ASSERT(worker_thread_ == rtc::Thread::Current()); | 271 ASSERT(worker_thread_ == rtc::Thread::Current()); |
306 // Need to destroy the voice/video channels | 272 // Need to destroy the voice/video channels |
307 while (!video_channels_.empty()) { | 273 while (!video_channels_.empty()) { |
308 DestroyVideoChannel_w(video_channels_.back()); | 274 DestroyVideoChannel_w(video_channels_.back()); |
309 } | 275 } |
310 while (!voice_channels_.empty()) { | 276 while (!voice_channels_.empty()) { |
311 DestroyVoiceChannel_w(voice_channels_.back()); | 277 DestroyVoiceChannel_w(voice_channels_.back()); |
312 } | 278 } |
313 if (!SetCaptureDevice_w(NULL)) { | |
314 LOG(LS_WARNING) << "failed to delete video capturer"; | |
315 } | |
316 media_engine_->Terminate(); | 279 media_engine_->Terminate(); |
317 } | 280 } |
318 | 281 |
319 VoiceChannel* ChannelManager::CreateVoiceChannel( | 282 VoiceChannel* ChannelManager::CreateVoiceChannel( |
320 webrtc::MediaControllerInterface* media_controller, | 283 webrtc::MediaControllerInterface* media_controller, |
321 BaseSession* session, | 284 BaseSession* session, |
322 const std::string& content_name, | 285 const std::string& content_name, |
323 bool rtcp, | 286 bool rtcp, |
324 const AudioOptions& options) { | 287 const AudioOptions& options) { |
325 return worker_thread_->Invoke<VoiceChannel*>( | 288 return worker_thread_->Invoke<VoiceChannel*>( |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
485 DataChannels::iterator it = std::find(data_channels_.begin(), | 448 DataChannels::iterator it = std::find(data_channels_.begin(), |
486 data_channels_.end(), data_channel); | 449 data_channels_.end(), data_channel); |
487 ASSERT(it != data_channels_.end()); | 450 ASSERT(it != data_channels_.end()); |
488 if (it == data_channels_.end()) | 451 if (it == data_channels_.end()) |
489 return; | 452 return; |
490 | 453 |
491 data_channels_.erase(it); | 454 data_channels_.erase(it); |
492 delete data_channel; | 455 delete data_channel; |
493 } | 456 } |
494 | 457 |
495 bool ChannelManager::GetAudioOptions(std::string* in_name, | |
496 std::string* out_name, | |
497 AudioOptions* options) { | |
498 if (in_name) | |
499 *in_name = audio_in_device_; | |
500 if (out_name) | |
501 *out_name = audio_out_device_; | |
502 if (options) | |
503 *options = audio_options_; | |
504 return true; | |
505 } | |
506 | |
507 bool ChannelManager::SetAudioOptions(const std::string& in_name, | |
508 const std::string& out_name, | |
509 const AudioOptions& options) { | |
510 return SetAudioOptions(in_name, out_name, options, audio_delay_offset_); | |
511 } | |
512 | |
513 bool ChannelManager::SetAudioOptions(const std::string& in_name, | 458 bool ChannelManager::SetAudioOptions(const std::string& in_name, |
514 const std::string& out_name, | 459 const std::string& out_name, |
515 const AudioOptions& options, | 460 const AudioOptions& options, |
516 int delay_offset) { | 461 int delay_offset) { |
517 // Get device ids from DeviceManager. | 462 // "Get device ids from DeviceManager" - these are the defaults returned. |
518 Device in_dev, out_dev; | 463 Device in_dev("", -1); |
519 if (!device_manager_->GetAudioInputDevice(in_name, &in_dev)) { | 464 Device out_dev("", -1); |
520 LOG(LS_WARNING) << "Failed to GetAudioInputDevice: " << in_name; | |
521 return false; | |
522 } | |
523 if (!device_manager_->GetAudioOutputDevice(out_name, &out_dev)) { | |
524 LOG(LS_WARNING) << "Failed to GetAudioOutputDevice: " << out_name; | |
525 return false; | |
526 } | |
527 | 465 |
528 // If we're initialized, pass the settings to the media engine. | 466 // If we're initialized, pass the settings to the media engine. |
529 bool ret = true; | 467 bool ret = true; |
530 if (initialized_) { | 468 if (initialized_) { |
531 ret = worker_thread_->Invoke<bool>( | 469 ret = worker_thread_->Invoke<bool>( |
532 Bind(&ChannelManager::SetAudioOptions_w, this, | 470 Bind(&ChannelManager::SetAudioOptions_w, this, |
533 options, delay_offset, &in_dev, &out_dev)); | 471 options, delay_offset, &in_dev, &out_dev)); |
534 } | 472 } |
535 | 473 |
536 // If all worked well, save the values for use in GetAudioOptions. | 474 // If all worked well, save the values for use in GetAudioOptions. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 media_engine_.get(), level)); | 518 media_engine_.get(), level)); |
581 } | 519 } |
582 | 520 |
583 if (ret) { | 521 if (ret) { |
584 audio_output_volume_ = level; | 522 audio_output_volume_ = level; |
585 } | 523 } |
586 | 524 |
587 return ret; | 525 return ret; |
588 } | 526 } |
589 | 527 |
590 bool ChannelManager::IsSameCapturer(const std::string& capturer_name, | |
591 VideoCapturer* capturer) { | |
592 if (capturer == NULL) { | |
593 return false; | |
594 } | |
595 Device device; | |
596 if (!device_manager_->GetVideoCaptureDevice(capturer_name, &device)) { | |
597 return false; | |
598 } | |
599 return capturer->GetId() == device.id; | |
600 } | |
601 | |
602 bool ChannelManager::GetVideoCaptureDevice(Device* device) { | |
603 std::string device_name; | |
604 if (!GetCaptureDevice(&device_name)) { | |
605 return false; | |
606 } | |
607 return device_manager_->GetVideoCaptureDevice(device_name, device); | |
608 } | |
609 | |
610 bool ChannelManager::GetCaptureDevice(std::string* cam_name) { | |
611 if (camera_device_.empty()) { | |
612 // Initialize camera_device_ with default. | |
613 Device device; | |
614 if (!device_manager_->GetVideoCaptureDevice( | |
615 DeviceManagerInterface::kDefaultDeviceName, &device)) { | |
616 LOG(LS_WARNING) << "Device manager can't find default camera: " << | |
617 DeviceManagerInterface::kDefaultDeviceName; | |
618 return false; | |
619 } | |
620 camera_device_ = device.name; | |
621 } | |
622 *cam_name = camera_device_; | |
623 return true; | |
624 } | |
625 | |
626 bool ChannelManager::SetCaptureDevice(const std::string& cam_name) { | |
627 Device device; | |
628 bool ret = true; | |
629 if (!device_manager_->GetVideoCaptureDevice(cam_name, &device)) { | |
630 if (!cam_name.empty()) { | |
631 LOG(LS_WARNING) << "Device manager can't find camera: " << cam_name; | |
632 } | |
633 ret = false; | |
634 } | |
635 | |
636 // If we're running, tell the media engine about it. | |
637 if (initialized_ && ret) { | |
638 ret = worker_thread_->Invoke<bool>( | |
639 Bind(&ChannelManager::SetCaptureDevice_w, this, &device)); | |
640 } | |
641 | |
642 // If everything worked, retain the name of the selected camera. | |
643 if (ret) { | |
644 camera_device_ = device.name; | |
645 } else if (camera_device_.empty()) { | |
646 // When video option setting fails, we still want camera_device_ to be in a | |
647 // good state, so we initialize it with default if it's empty. | |
648 Device default_device; | |
649 if (!device_manager_->GetVideoCaptureDevice( | |
650 DeviceManagerInterface::kDefaultDeviceName, &default_device)) { | |
651 LOG(LS_WARNING) << "Device manager can't find default camera: " << | |
652 DeviceManagerInterface::kDefaultDeviceName; | |
653 } | |
654 camera_device_ = default_device.name; | |
655 } | |
656 | |
657 return ret; | |
658 } | |
659 | |
660 VideoCapturer* ChannelManager::CreateVideoCapturer() { | |
pthatcher1
2015/09/23 15:40:21
This is used still used:
https://cs.corp.google.c
| |
661 Device device; | |
662 if (!device_manager_->GetVideoCaptureDevice(camera_device_, &device)) { | |
663 if (!camera_device_.empty()) { | |
664 LOG(LS_WARNING) << "Device manager can't find camera: " << camera_device_; | |
665 } | |
666 return NULL; | |
667 } | |
668 VideoCapturer* capturer = device_manager_->CreateVideoCapturer(device); | |
669 if (capturer && default_video_encoder_config_.max_codec.id != 0) { | |
670 // For now, use the aspect ratio of the default_video_encoder_config_, | |
671 // which may be different than the native aspect ratio of the start | |
672 // format the camera may use. | |
673 capturer->UpdateAspectRatio( | |
674 default_video_encoder_config_.max_codec.width, | |
675 default_video_encoder_config_.max_codec.height); | |
676 } | |
677 return capturer; | |
678 } | |
679 | |
680 VideoCapturer* ChannelManager::CreateScreenCapturer( | |
681 const ScreencastId& screenid) { | |
682 return device_manager_->CreateScreenCapturer(screenid); | |
683 } | |
684 | |
685 bool ChannelManager::SetCaptureDevice_w(const Device* cam_device) { | |
686 ASSERT(worker_thread_ == rtc::Thread::Current()); | |
687 ASSERT(initialized_); | |
688 | |
689 if (!cam_device) { | |
690 video_device_name_.clear(); | |
691 return true; | |
692 } | |
693 video_device_name_ = cam_device->name; | |
694 return true; | |
695 } | |
696 | |
697 bool ChannelManager::SetDefaultVideoEncoderConfig(const VideoEncoderConfig& c) { | 528 bool ChannelManager::SetDefaultVideoEncoderConfig(const VideoEncoderConfig& c) { |
698 bool ret = true; | 529 bool ret = true; |
699 if (initialized_) { | 530 if (initialized_) { |
700 ret = worker_thread_->Invoke<bool>( | 531 ret = worker_thread_->Invoke<bool>( |
701 Bind(&MediaEngineInterface::SetDefaultVideoEncoderConfig, | 532 Bind(&MediaEngineInterface::SetDefaultVideoEncoderConfig, |
702 media_engine_.get(), c)); | 533 media_engine_.get(), c)); |
703 } | 534 } |
704 if (ret) { | 535 if (ret) { |
705 default_video_encoder_config_ = c; | 536 default_video_encoder_config_ = c; |
706 } | 537 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
834 | 665 |
835 | 666 |
836 static void GetDeviceNames(const std::vector<Device>& devs, | 667 static void GetDeviceNames(const std::vector<Device>& devs, |
837 std::vector<std::string>* names) { | 668 std::vector<std::string>* names) { |
838 names->clear(); | 669 names->clear(); |
839 for (size_t i = 0; i < devs.size(); ++i) { | 670 for (size_t i = 0; i < devs.size(); ++i) { |
840 names->push_back(devs[i].name); | 671 names->push_back(devs[i].name); |
841 } | 672 } |
842 } | 673 } |
843 | 674 |
844 bool ChannelManager::GetAudioInputDevices(std::vector<std::string>* names) { | |
845 names->clear(); | |
846 std::vector<Device> devs; | |
847 bool ret = device_manager_->GetAudioInputDevices(&devs); | |
848 if (ret) | |
849 GetDeviceNames(devs, names); | |
850 | |
851 return ret; | |
852 } | |
853 | |
854 bool ChannelManager::GetAudioOutputDevices(std::vector<std::string>* names) { | |
855 names->clear(); | |
856 std::vector<Device> devs; | |
857 bool ret = device_manager_->GetAudioOutputDevices(&devs); | |
858 if (ret) | |
859 GetDeviceNames(devs, names); | |
860 | |
861 return ret; | |
862 } | |
863 | |
864 bool ChannelManager::GetVideoCaptureDevices(std::vector<std::string>* names) { | |
865 names->clear(); | |
866 std::vector<Device> devs; | |
867 bool ret = device_manager_->GetVideoCaptureDevices(&devs); | |
868 if (ret) | |
869 GetDeviceNames(devs, names); | |
870 | |
871 return ret; | |
872 } | |
873 | |
874 void ChannelManager::SetVideoCaptureDeviceMaxFormat( | |
875 const std::string& usb_id, | |
876 const VideoFormat& max_format) { | |
877 device_manager_->SetVideoCaptureDeviceMaxFormat(usb_id, max_format); | |
878 } | |
879 | |
880 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { | 675 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { |
881 return worker_thread_->Invoke<bool>( | 676 return worker_thread_->Invoke<bool>( |
882 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); | 677 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); |
883 } | 678 } |
884 | 679 |
885 } // namespace cricket | 680 } // namespace cricket |
OLD | NEW |