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

Side by Side Diff: content/browser/renderer_host/media/audio_input_device_manager.h

Issue 154143002: Remove MediaStreamDeviceThread in favor of audio worker TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 // AudioInputDeviceManager manages the audio input devices. In particular it 5 // AudioInputDeviceManager manages the audio input devices. In particular it
6 // communicates with MediaStreamManager and AudioInputRendererHost on the 6 // communicates with MediaStreamManager and AudioInputRendererHost on the
7 // browser IO thread, handles queries like 7 // browser IO thread, handles queries like
8 // enumerate/open/close/GetOpenedDeviceInfoById from MediaStreamManager and 8 // enumerate/open/close/GetOpenedDeviceInfoById from MediaStreamManager and
9 // GetOpenedDeviceInfoById from AudioInputRendererHost. 9 // GetOpenedDeviceInfoById from AudioInputRendererHost.
10 // The work for enumerate/open/close is handled asynchronously on Media Stream 10 // The work for enumerate/open/close is handled asynchronously on Media Stream
11 // device thread, while GetOpenedDeviceInfoById is synchronous on the IO thread. 11 // device thread, while GetOpenedDeviceInfoById is synchronous on the IO thread.
henrika (OOO until Aug 14) 2014/02/05 08:42:03 Is this comment still valid?
DaleCurtis 2014/02/05 21:47:11 Yes. I'm not removing any references to the devic
12 12
13 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ 13 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_
14 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ 14 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_
15 15
16 #include <map> 16 #include <map>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
21 #include "content/browser/renderer_host/media/media_stream_provider.h" 21 #include "content/browser/renderer_host/media/media_stream_provider.h"
(...skipping 16 matching lines...) Expand all
38 static const int kFakeOpenSessionId; 38 static const int kFakeOpenSessionId;
39 39
40 explicit AudioInputDeviceManager(media::AudioManager* audio_manager); 40 explicit AudioInputDeviceManager(media::AudioManager* audio_manager);
41 41
42 // Gets the opened device info by |session_id|. Returns NULL if the device 42 // Gets the opened device info by |session_id|. Returns NULL if the device
43 // is not opened, otherwise the opened device. Called on IO thread. 43 // is not opened, otherwise the opened device. Called on IO thread.
44 const StreamDeviceInfo* GetOpenedDeviceInfoById(int session_id); 44 const StreamDeviceInfo* GetOpenedDeviceInfoById(int session_id);
45 45
46 // MediaStreamProvider implementation, called on IO thread. 46 // MediaStreamProvider implementation, called on IO thread.
47 virtual void Register(MediaStreamProviderListener* listener, 47 virtual void Register(MediaStreamProviderListener* listener,
48 base::MessageLoopProxy* device_thread_loop) OVERRIDE; 48 const scoped_refptr<base::SingleThreadTaskRunner>&
49 device_task_runner) OVERRIDE;
49 virtual void Unregister() OVERRIDE; 50 virtual void Unregister() OVERRIDE;
50 virtual void EnumerateDevices(MediaStreamType stream_type) OVERRIDE; 51 virtual void EnumerateDevices(MediaStreamType stream_type) OVERRIDE;
51 virtual int Open(const StreamDeviceInfo& device) OVERRIDE; 52 virtual int Open(const StreamDeviceInfo& device) OVERRIDE;
52 virtual void Close(int session_id) OVERRIDE; 53 virtual void Close(int session_id) OVERRIDE;
53 54
54 void UseFakeDevice(); 55 void UseFakeDevice();
55 bool ShouldUseFakeDevice() const; 56 bool ShouldUseFakeDevice() const;
56 57
57 private: 58 private:
58 typedef std::vector<StreamDeviceInfo> StreamDeviceList; 59 typedef std::vector<StreamDeviceInfo> StreamDeviceList;
(...skipping 24 matching lines...) Expand all
83 84
84 // Only accessed on Browser::IO thread. 85 // Only accessed on Browser::IO thread.
85 MediaStreamProviderListener* listener_; 86 MediaStreamProviderListener* listener_;
86 int next_capture_session_id_; 87 int next_capture_session_id_;
87 bool use_fake_device_; 88 bool use_fake_device_;
88 StreamDeviceList devices_; 89 StreamDeviceList devices_;
89 90
90 media::AudioManager* const audio_manager_; // Weak. 91 media::AudioManager* const audio_manager_; // Weak.
91 92
92 // The message loop of media stream device thread that this object runs on. 93 // The message loop of media stream device thread that this object runs on.
93 scoped_refptr<base::MessageLoopProxy> device_loop_; 94 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
94 95
95 DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager); 96 DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager);
96 }; 97 };
97 98
98 } // namespace content 99 } // namespace content
99 100
100 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ 101 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698