| 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 // AudioRendererHost serves audio related requests from AudioRenderer which | 5 // AudioRendererHost serves audio related requests from AudioRenderer which |
| 6 // lives inside the render process and provide access to audio hardware. | 6 // lives inside the render process and provide access to audio hardware. |
| 7 // | 7 // |
| 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI |
| 9 // thread, but all other operations and method calls happen on IO thread, so we | 9 // thread, but all other operations and method calls happen on IO thread, so we |
| 10 // need to be extra careful about the lifetime of this object. AudioManager is a | 10 // need to be extra careful about the lifetime of this object. AudioManager is a |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // BrowserMessageFilter implementation. | 76 // BrowserMessageFilter implementation. |
| 77 virtual void OnChannelClosing() OVERRIDE; | 77 virtual void OnChannelClosing() OVERRIDE; |
| 78 virtual void OnDestruct() const OVERRIDE; | 78 virtual void OnDestruct() const OVERRIDE; |
| 79 virtual bool OnMessageReceived(const IPC::Message& message, | 79 virtual bool OnMessageReceived(const IPC::Message& message, |
| 80 bool* message_was_ok) OVERRIDE; | 80 bool* message_was_ok) OVERRIDE; |
| 81 | 81 |
| 82 // AudioOutputController::EventHandler implementations. | 82 // AudioOutputController::EventHandler implementations. |
| 83 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; | 83 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; |
| 84 virtual void OnPlaying(media::AudioOutputController* controller) OVERRIDE; | 84 virtual void OnPlaying(media::AudioOutputController* controller) OVERRIDE; |
| 85 virtual void OnPaused(media::AudioOutputController* controller) OVERRIDE; | 85 virtual void OnPaused(media::AudioOutputController* controller) OVERRIDE; |
| 86 virtual void OnError(media::AudioOutputController* controller, | 86 virtual void OnError(media::AudioOutputController* controller) OVERRIDE; |
| 87 int error_code) OVERRIDE; | |
| 88 virtual void OnDeviceChange(media::AudioOutputController* controller, | 87 virtual void OnDeviceChange(media::AudioOutputController* controller, |
| 89 int new_buffer_size, | 88 int new_buffer_size, |
| 90 int new_sample_rate) OVERRIDE; | 89 int new_sample_rate) OVERRIDE; |
| 91 | 90 |
| 92 private: | 91 private: |
| 93 friend class AudioRendererHostTest; | 92 friend class AudioRendererHostTest; |
| 94 friend class BrowserThread; | 93 friend class BrowserThread; |
| 95 friend class base::DeleteHelper<AudioRendererHost>; | 94 friend class base::DeleteHelper<AudioRendererHost>; |
| 96 friend class MockAudioRendererHost; | 95 friend class MockAudioRendererHost; |
| 97 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); | 96 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // shared memory or shared socket in low latency mode. | 133 // shared memory or shared socket in low latency mode. |
| 135 void DoCompleteCreation(media::AudioOutputController* controller); | 134 void DoCompleteCreation(media::AudioOutputController* controller); |
| 136 | 135 |
| 137 // Send a state change message to the renderer. | 136 // Send a state change message to the renderer. |
| 138 void DoSendPlayingMessage(media::AudioOutputController* controller); | 137 void DoSendPlayingMessage(media::AudioOutputController* controller); |
| 139 void DoSendPausedMessage(media::AudioOutputController* controller); | 138 void DoSendPausedMessage(media::AudioOutputController* controller); |
| 140 void DoSendDeviceChangeMessage(media::AudioOutputController* controller, | 139 void DoSendDeviceChangeMessage(media::AudioOutputController* controller, |
| 141 int new_buffer_size, int new_sample_rate); | 140 int new_buffer_size, int new_sample_rate); |
| 142 | 141 |
| 143 // Handle error coming from audio stream. | 142 // Handle error coming from audio stream. |
| 144 void DoHandleError(media::AudioOutputController* controller, int error_code); | 143 void DoHandleError(media::AudioOutputController* controller); |
| 145 | 144 |
| 146 // Send an error message to the renderer. | 145 // Send an error message to the renderer. |
| 147 void SendErrorMessage(int stream_id); | 146 void SendErrorMessage(int stream_id); |
| 148 | 147 |
| 149 // Delete all audio entry and all audio streams | 148 // Delete all audio entry and all audio streams |
| 150 void DeleteEntries(); | 149 void DeleteEntries(); |
| 151 | 150 |
| 152 // Closes the stream. The stream is then deleted in DeleteEntry() after it | 151 // Closes the stream. The stream is then deleted in DeleteEntry() after it |
| 153 // is closed. | 152 // is closed. |
| 154 void CloseAndDeleteStream(AudioEntry* entry); | 153 void CloseAndDeleteStream(AudioEntry* entry); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 180 | 179 |
| 181 // A map of stream IDs to audio sources. | 180 // A map of stream IDs to audio sources. |
| 182 AudioEntryMap audio_entries_; | 181 AudioEntryMap audio_entries_; |
| 183 | 182 |
| 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 183 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 185 }; | 184 }; |
| 186 | 185 |
| 187 } // namespace content | 186 } // namespace content |
| 188 | 187 |
| 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 188 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |