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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Called by AudioOutputProxy when the volume is set. | 59 // Called by AudioOutputProxy when the volume is set. |
60 virtual void StreamVolumeSet(AudioOutputProxy* stream_proxy, | 60 virtual void StreamVolumeSet(AudioOutputProxy* stream_proxy, |
61 double volume) = 0; | 61 double volume) = 0; |
62 | 62 |
63 // Called by AudioOutputProxy when the stream is closed. | 63 // Called by AudioOutputProxy when the stream is closed. |
64 virtual void CloseStream(AudioOutputProxy* stream_proxy) = 0; | 64 virtual void CloseStream(AudioOutputProxy* stream_proxy) = 0; |
65 | 65 |
66 // Called on the audio thread when the AudioManager is shutting down. | 66 // Called on the audio thread when the AudioManager is shutting down. |
67 virtual void Shutdown() = 0; | 67 virtual void Shutdown() = 0; |
68 | 68 |
| 69 // 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 |
| 71 // 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 |
| 73 virtual void CloseStreamsForWedgeFix() = 0; |
| 74 virtual void RestartStreamsForWedgeFix() = 0; |
| 75 |
69 // Accessor to the input device id used by unified IO. | 76 // Accessor to the input device id used by unified IO. |
70 const std::string& input_device_id() const { return input_device_id_; } | 77 const std::string& input_device_id() const { return input_device_id_; } |
71 | 78 |
72 protected: | 79 protected: |
73 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; | 80 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; |
74 friend class AudioOutputProxyTest; | 81 friend class AudioOutputProxyTest; |
75 | 82 |
76 virtual ~AudioOutputDispatcher(); | 83 virtual ~AudioOutputDispatcher(); |
77 | 84 |
78 // A no-reference-held pointer (we don't want circular references) back to the | 85 // A no-reference-held pointer (we don't want circular references) back to the |
79 // AudioManager that owns this object. | 86 // AudioManager that owns this object. |
80 AudioManager* audio_manager_; | 87 AudioManager* audio_manager_; |
81 const scoped_refptr<base::MessageLoopProxy> message_loop_; | 88 const scoped_refptr<base::MessageLoopProxy> message_loop_; |
82 const AudioParameters params_; | 89 const AudioParameters params_; |
83 const std::string output_device_id_; | 90 const std::string output_device_id_; |
84 const std::string input_device_id_; | 91 const std::string input_device_id_; |
85 | 92 |
86 private: | 93 private: |
87 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 94 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
88 }; | 95 }; |
89 | 96 |
90 } // namespace media | 97 } // namespace media |
91 | 98 |
92 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 99 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
OLD | NEW |