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 // 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Called by AudioOutputProxy when the volume is set. | 58 // Called by AudioOutputProxy when the volume is set. |
59 virtual void StreamVolumeSet(AudioOutputProxy* stream_proxy, | 59 virtual void StreamVolumeSet(AudioOutputProxy* stream_proxy, |
60 double volume) = 0; | 60 double volume) = 0; |
61 | 61 |
62 // Called by AudioOutputProxy when the stream is closed. | 62 // Called by AudioOutputProxy when the stream is closed. |
63 virtual void CloseStream(AudioOutputProxy* stream_proxy) = 0; | 63 virtual void CloseStream(AudioOutputProxy* stream_proxy) = 0; |
64 | 64 |
65 // Called on the audio thread when the AudioManager is shutting down. | 65 // Called on the audio thread when the AudioManager is shutting down. |
66 virtual void Shutdown() = 0; | 66 virtual void Shutdown() = 0; |
67 | 67 |
68 // Called by the AudioManager to restart streams when a wedge is detected. A | |
69 // wedge means the OS failed to request any audio after StartStream(). When a | |
70 // wedge is detected all streams across all dispatchers must be closed. After | |
71 // all streams are closed, streams are restarted. See http://crbug.com/160920 | |
72 virtual void CloseStreamsForWedgeFix() = 0; | |
73 virtual void RestartStreamsForWedgeFix() = 0; | |
74 | |
75 const std::string& device_id() const { return device_id_; } | 68 const std::string& device_id() const { return device_id_; } |
76 | 69 |
77 protected: | 70 protected: |
78 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; | 71 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; |
79 virtual ~AudioOutputDispatcher(); | 72 virtual ~AudioOutputDispatcher(); |
80 | 73 |
81 // A no-reference-held pointer (we don't want circular references) back to the | 74 // A no-reference-held pointer (we don't want circular references) back to the |
82 // AudioManager that owns this object. | 75 // AudioManager that owns this object. |
83 AudioManager* audio_manager_; | 76 AudioManager* audio_manager_; |
84 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 77 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
85 const AudioParameters params_; | 78 const AudioParameters params_; |
86 std::string device_id_; | 79 std::string device_id_; |
87 | 80 |
88 private: | 81 private: |
89 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 82 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
90 }; | 83 }; |
91 | 84 |
92 } // namespace media | 85 } // namespace media |
93 | 86 |
94 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 87 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
OLD | NEW |