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

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

Issue 163343002: Reland 153623004: Remove the unified IO code on the browser (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the cras bot 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
« no previous file with comments | « media/audio/audio_output_controller_unittest.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().
(...skipping 20 matching lines...) Expand all
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,
40 const AudioParameters& params, 40 const AudioParameters& params,
41 const std::string& output_device_id, 41 const std::string& device_id);
42 const std::string& input_device_id);
43 42
44 // Called by AudioOutputProxy to open the stream. 43 // Called by AudioOutputProxy to open the stream.
45 // Returns false, if it fails to open it. 44 // Returns false, if it fails to open it.
46 virtual bool OpenStream() = 0; 45 virtual bool OpenStream() = 0;
47 46
48 // Called by AudioOutputProxy when the stream is started. 47 // Called by AudioOutputProxy when the stream is started.
49 // Uses |callback| to get source data and report errors, if any. 48 // Uses |callback| to get source data and report errors, if any.
50 // Does *not* take ownership of this callback. 49 // Does *not* take ownership of this callback.
51 // Returns true if started successfully, false otherwise. 50 // Returns true if started successfully, false otherwise.
52 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback, 51 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback,
(...skipping 13 matching lines...) Expand all
66 // Called on the audio thread when the AudioManager is shutting down. 65 // Called on the audio thread when the AudioManager is shutting down.
67 virtual void Shutdown() = 0; 66 virtual void Shutdown() = 0;
68 67
69 // Called by the AudioManager to restart streams when a wedge is detected. A 68 // Called by the AudioManager to restart streams when a wedge is detected. A
70 // wedge means the OS failed to request any audio after StartStream(). When a 69 // wedge means the OS failed to request any audio after StartStream(). When a
71 // wedge is detected all streams across all dispatchers must be closed. After 70 // wedge is detected all streams across all dispatchers must be closed. After
72 // all streams are closed, streams are restarted. See http://crbug.com/160920 71 // all streams are closed, streams are restarted. See http://crbug.com/160920
73 virtual void CloseStreamsForWedgeFix() = 0; 72 virtual void CloseStreamsForWedgeFix() = 0;
74 virtual void RestartStreamsForWedgeFix() = 0; 73 virtual void RestartStreamsForWedgeFix() = 0;
75 74
76 // Accessor to the input device id used by unified IO. 75 const std::string& device_id() const { return device_id_; }
77 const std::string& input_device_id() const { return input_device_id_; }
78 76
79 protected: 77 protected:
80 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; 78 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>;
81 virtual ~AudioOutputDispatcher(); 79 virtual ~AudioOutputDispatcher();
82 80
83 // A no-reference-held pointer (we don't want circular references) back to the 81 // A no-reference-held pointer (we don't want circular references) back to the
84 // AudioManager that owns this object. 82 // AudioManager that owns this object.
85 AudioManager* audio_manager_; 83 AudioManager* audio_manager_;
86 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 84 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
87 const AudioParameters params_; 85 const AudioParameters params_;
88 std::string output_device_id_; 86 std::string device_id_;
89 const std::string input_device_id_;
90 87
91 private: 88 private:
92 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); 89 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher);
93 }; 90 };
94 91
95 } // namespace media 92 } // namespace media
96 93
97 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ 94 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller_unittest.cc ('k') | media/audio/audio_output_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698