| 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 13 #include "base/win/scoped_com_initializer.h" |
| 13 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 14 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 14 #include "content/browser/renderer_host/media/media_stream_device_settings.h" | 15 #include "content/browser/renderer_host/media/media_stream_device_settings.h" |
| 15 #include "content/browser/renderer_host/media/media_stream_requester.h" | 16 #include "content/browser/renderer_host/media/media_stream_requester.h" |
| 16 #include "content/browser/renderer_host/media/video_capture_manager.h" | 17 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 17 #include "content/common/media/media_stream_options.h" | 18 #include "content/common/media/media_stream_options.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
| 20 #include "content/public/browser/media_observer.h" | 21 #include "content/public/browser/media_observer.h" |
| 21 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 22 | 23 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE && | 50 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE && |
| 50 options.video) { | 51 options.video) { |
| 51 return true; | 52 return true; |
| 52 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE && | 53 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE && |
| 53 options.audio) { | 54 options.audio) { |
| 54 return true; | 55 return true; |
| 55 } | 56 } |
| 56 return false; | 57 return false; |
| 57 } | 58 } |
| 58 | 59 |
| 60 DeviceThread::DeviceThread(const char* name) |
| 61 : base::Thread(name) { |
| 62 } |
| 63 |
| 64 DeviceThread::~DeviceThread() { |
| 65 } |
| 66 |
| 67 void DeviceThread::Init() { |
| 68 using base::win::ScopedCOMInitializer; |
| 69 // Enter the multi-threaded apartment. |
| 70 com_initializer_.reset(new ScopedCOMInitializer(ScopedCOMInitializer::kMTA)); |
| 71 } |
| 72 |
| 73 void DeviceThread::CleanUp() { |
| 74 com_initializer_.reset(); |
| 75 } |
| 76 |
| 59 // TODO(xians): Merge DeviceRequest with MediaStreamRequest. | 77 // TODO(xians): Merge DeviceRequest with MediaStreamRequest. |
| 60 struct MediaStreamManager::DeviceRequest { | 78 struct MediaStreamManager::DeviceRequest { |
| 61 enum RequestState { | 79 enum RequestState { |
| 62 kNotRequested = 0, | 80 kNotRequested = 0, |
| 63 kRequested, | 81 kRequested, |
| 64 kPendingApproval, | 82 kPendingApproval, |
| 65 kOpening, | 83 kOpening, |
| 66 kDone, | 84 kDone, |
| 67 kError | 85 kError |
| 68 }; | 86 }; |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE) { | 701 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE) { |
| 684 return video_capture_manager(); | 702 return video_capture_manager(); |
| 685 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) { | 703 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) { |
| 686 return audio_input_device_manager(); | 704 return audio_input_device_manager(); |
| 687 } | 705 } |
| 688 NOTREACHED(); | 706 NOTREACHED(); |
| 689 return NULL; | 707 return NULL; |
| 690 } | 708 } |
| 691 | 709 |
| 692 } // namespace media_stream | 710 } // namespace media_stream |
| OLD | NEW |