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

Side by Side Diff: media/audio/audio_output_dispatcher.h

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win and audio tests Created 6 years, 11 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
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/audio_output_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // AudioOutputDispatcher is a single-threaded base class that dispatches 5 // AudioOutputDispatcher is a single-threaded base class that dispatches
6 // creation and deletion of audio output streams. AudioOutputProxy objects use 6 // creation and deletion of audio output streams. AudioOutputProxy objects use
7 // this class to allocate and recycle actual audio output streams. When playback 7 // this class to allocate and recycle actual audio output streams. When playback
8 // is started, the proxy calls StartStream() to get an output stream that it 8 // is started, the proxy calls StartStream() to get an output stream that it
9 // uses to play audio. When playback is stopped, the proxy returns the stream 9 // uses to play audio. When playback is stopped, the proxy returns the stream
10 // back to the dispatcher by calling StopStream(). 10 // back to the dispatcher by calling StopStream().
11 // 11 //
12 // AudioManagerBase creates one specialization of AudioOutputDispatcher on the 12 // AudioManagerBase creates one specialization of AudioOutputDispatcher on the
13 // audio thread for each possible set of audio parameters. I.e streams with 13 // audio thread for each possible set of audio parameters. I.e streams with
14 // different parameters are managed independently. The AudioOutputDispatcher 14 // different parameters are managed independently. The AudioOutputDispatcher
15 // instance is then deleted on the audio thread when the AudioManager shuts 15 // instance is then deleted on the audio thread when the AudioManager shuts
16 // down. 16 // down.
17 17
18 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ 18 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
19 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ 19 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
20 20
21 #include "base/basictypes.h" 21 #include "base/basictypes.h"
22 #include "base/memory/ref_counted.h" 22 #include "base/memory/ref_counted.h"
23 #include "base/timer/timer.h" 23 #include "base/timer/timer.h"
24 #include "media/audio/audio_io.h" 24 #include "media/audio/audio_io.h"
25 #include "media/audio/audio_manager.h" 25 #include "media/audio/audio_manager.h"
26 #include "media/audio/audio_parameters.h" 26 #include "media/audio/audio_parameters.h"
27 27
28 namespace base { 28 namespace base {
29 class MessageLoopProxy; 29 class SingleThreadTaskRunner;
30 } 30 }
31 31
32 namespace media { 32 namespace media {
33 33
34 class AudioOutputProxy; 34 class AudioOutputProxy;
35 35
36 class MEDIA_EXPORT AudioOutputDispatcher 36 class MEDIA_EXPORT AudioOutputDispatcher
37 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { 37 : public base::RefCountedThreadSafe<AudioOutputDispatcher> {
38 public: 38 public:
39 AudioOutputDispatcher(AudioManager* audio_manager, 39 AudioOutputDispatcher(AudioManager* audio_manager,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Accessor to the input device id used by unified IO. 76 // Accessor to the input device id used by unified IO.
77 const std::string& input_device_id() const { return input_device_id_; } 77 const std::string& input_device_id() const { return input_device_id_; }
78 78
79 protected: 79 protected:
80 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; 80 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>;
81 virtual ~AudioOutputDispatcher(); 81 virtual ~AudioOutputDispatcher();
82 82
83 // A no-reference-held pointer (we don't want circular references) back to the 83 // A no-reference-held pointer (we don't want circular references) back to the
84 // AudioManager that owns this object. 84 // AudioManager that owns this object.
85 AudioManager* audio_manager_; 85 AudioManager* audio_manager_;
86 const scoped_refptr<base::MessageLoopProxy> message_loop_; 86 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
87 const AudioParameters params_; 87 const AudioParameters params_;
88 std::string output_device_id_; 88 std::string output_device_id_;
89 const std::string input_device_id_; 89 const std::string input_device_id_;
90 90
91 private: 91 private:
92 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); 92 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher);
93 }; 93 };
94 94
95 } // namespace media 95 } // namespace media
96 96
97 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ 97 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/audio_output_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698