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 <objbase.h> | |
tommi (sloooow) - chröme
2012/07/06 22:17:09
won't this cause problems on non windows platforms
grt (UTC plus 2)
2012/07/06 23:07:25
what non-windows platforms? ;-)
| |
8 | |
7 #include <list> | 9 #include <list> |
8 | 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
13 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 15 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
14 #include "content/browser/renderer_host/media/media_stream_device_settings.h" | 16 #include "content/browser/renderer_host/media/media_stream_device_settings.h" |
15 #include "content/browser/renderer_host/media/media_stream_requester.h" | 17 #include "content/browser/renderer_host/media/media_stream_requester.h" |
16 #include "content/browser/renderer_host/media/video_capture_manager.h" | 18 #include "content/browser/renderer_host/media/video_capture_manager.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE && | 51 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE && |
50 options.video) { | 52 options.video) { |
51 return true; | 53 return true; |
52 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE && | 54 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE && |
53 options.audio) { | 55 options.audio) { |
54 return true; | 56 return true; |
55 } | 57 } |
56 return false; | 58 return false; |
57 } | 59 } |
58 | 60 |
61 DeviceThread::DeviceThread(const char* name) | |
62 : base::Thread(name), com_initialized_() { | |
63 } | |
64 | |
65 void DeviceThread::Init() { | |
66 // Enter the multi-threaded apartment. | |
67 HRESULT hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); | |
tommi (sloooow) - chröme
2012/07/06 22:17:09
I thought that this file was a cross platform file
| |
68 DCHECK_EQ(hr, S_OK); | |
69 com_initialized_ = SUCCEEDED(hr); | |
70 } | |
71 | |
72 void DeviceThread::CleanUp() { | |
73 if (com_initialized_) { | |
74 CoUninitialize(); | |
75 com_initialized_ = false; | |
76 } | |
77 } | |
78 | |
59 // TODO(xians): Merge DeviceRequest with MediaStreamRequest. | 79 // TODO(xians): Merge DeviceRequest with MediaStreamRequest. |
60 struct MediaStreamManager::DeviceRequest { | 80 struct MediaStreamManager::DeviceRequest { |
61 enum RequestState { | 81 enum RequestState { |
62 kNotRequested = 0, | 82 kNotRequested = 0, |
63 kRequested, | 83 kRequested, |
64 kPendingApproval, | 84 kPendingApproval, |
65 kOpening, | 85 kOpening, |
66 kDone, | 86 kDone, |
67 kError | 87 kError |
68 }; | 88 }; |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE) { | 703 if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE) { |
684 return video_capture_manager(); | 704 return video_capture_manager(); |
685 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) { | 705 } else if (stream_type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) { |
686 return audio_input_device_manager(); | 706 return audio_input_device_manager(); |
687 } | 707 } |
688 NOTREACHED(); | 708 NOTREACHED(); |
689 return NULL; | 709 return NULL; |
690 } | 710 } |
691 | 711 |
692 } // namespace media_stream | 712 } // namespace media_stream |
OLD | NEW |