| 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/media_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 if (IsAudioMediaType(audio_type)) | 608 if (IsAudioMediaType(audio_type)) |
| 609 request->SetState(audio_type, MEDIA_REQUEST_STATE_PENDING_APPROVAL); | 609 request->SetState(audio_type, MEDIA_REQUEST_STATE_PENDING_APPROVAL); |
| 610 if (IsVideoMediaType(video_type)) | 610 if (IsVideoMediaType(video_type)) |
| 611 request->SetState(video_type, MEDIA_REQUEST_STATE_PENDING_APPROVAL); | 611 request->SetState(video_type, MEDIA_REQUEST_STATE_PENDING_APPROVAL); |
| 612 | 612 |
| 613 PostRequestToUI(label); | 613 PostRequestToUI(label); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void MediaStreamManager::InitializeDeviceManagersOnIOThread() { | 616 void MediaStreamManager::InitializeDeviceManagersOnIOThread() { |
| 617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 618 if (device_thread_.get()) | 618 if (device_thread_) |
| 619 return; | 619 return; |
| 620 | 620 |
| 621 device_thread_.reset(new base::Thread("MediaStreamDeviceThread")); | 621 device_thread_.reset(new base::Thread("MediaStreamDeviceThread")); |
| 622 #if defined(OS_WIN) | 622 #if defined(OS_WIN) |
| 623 device_thread_->init_com_with_mta(true); | 623 device_thread_->init_com_with_mta(true); |
| 624 #endif | 624 #endif |
| 625 CHECK(device_thread_->Start()); | 625 CHECK(device_thread_->Start()); |
| 626 | 626 |
| 627 audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_); | 627 audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_); |
| 628 audio_input_device_manager_->Register(this, | 628 audio_input_device_manager_->Register(this, |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 void MediaStreamManager::UseFakeDevice() { | 994 void MediaStreamManager::UseFakeDevice() { |
| 995 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 995 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 996 video_capture_manager()->UseFakeDevice(); | 996 video_capture_manager()->UseFakeDevice(); |
| 997 audio_input_device_manager()->UseFakeDevice(); | 997 audio_input_device_manager()->UseFakeDevice(); |
| 998 ui_controller_->UseFakeUI(); | 998 ui_controller_->UseFakeUI(); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 void MediaStreamManager::WillDestroyCurrentMessageLoop() { | 1001 void MediaStreamManager::WillDestroyCurrentMessageLoop() { |
| 1002 DCHECK_EQ(MessageLoop::current(), io_loop_); | 1002 DCHECK_EQ(MessageLoop::current(), io_loop_); |
| 1003 DCHECK(requests_.empty()); | 1003 DCHECK(requests_.empty()); |
| 1004 if (device_thread_.get()) { | 1004 if (device_thread_) { |
| 1005 StopMonitoring(); | 1005 StopMonitoring(); |
| 1006 | 1006 |
| 1007 video_capture_manager_->Unregister(); | 1007 video_capture_manager_->Unregister(); |
| 1008 audio_input_device_manager_->Unregister(); | 1008 audio_input_device_manager_->Unregister(); |
| 1009 device_thread_.reset(); | 1009 device_thread_.reset(); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 audio_input_device_manager_ = NULL; | 1012 audio_input_device_manager_ = NULL; |
| 1013 video_capture_manager_ = NULL; | 1013 video_capture_manager_ = NULL; |
| 1014 io_loop_ = NULL; | 1014 io_loop_ = NULL; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 // Always do enumeration even though some enumeration is in progress, | 1134 // Always do enumeration even though some enumeration is in progress, |
| 1135 // because those enumeration commands could be sent before these devices | 1135 // because those enumeration commands could be sent before these devices |
| 1136 // change. | 1136 // change. |
| 1137 ++active_enumeration_ref_count_[stream_type]; | 1137 ++active_enumeration_ref_count_[stream_type]; |
| 1138 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1138 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 } // namespace content | 1141 } // namespace content |
| OLD | NEW |