Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 10744002: Fix COM initialization on media thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | media/audio/win/device_enumeration_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698