| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); | 98 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); |
| 99 | 99 |
| 100 struct AudioEntry; | 100 struct AudioEntry; |
| 101 typedef std::map<int, AudioEntry*> AudioEntryMap; | 101 typedef std::map<int, AudioEntry*> AudioEntryMap; |
| 102 | 102 |
| 103 virtual ~AudioRendererHost(); | 103 virtual ~AudioRendererHost(); |
| 104 | 104 |
| 105 // Methods called on IO thread ---------------------------------------------- | 105 // Methods called on IO thread ---------------------------------------------- |
| 106 | 106 |
| 107 // Audio related IPC message handlers. | 107 // Audio related IPC message handlers. |
| 108 // Creates an audio output stream with the specified format. If this call is | 108 |
| 109 // successful this object would keep an internal entry of the stream for the | 109 // Creates an audio output stream with the specified format whose data is |
| 110 // required properties. | 110 // produced by an entity in the render view referenced by |render_view_id|. |
| 111 // Upon success/failure, the peer is notified via the NotifyStreamCreated |
| 112 // message. |
| 111 void OnCreateStream(int stream_id, | 113 void OnCreateStream(int stream_id, |
| 114 int render_view_id, |
| 112 const media::AudioParameters& params); | 115 const media::AudioParameters& params); |
| 113 | 116 |
| 114 // Track that the data for the audio stream referenced by |stream_id| is | |
| 115 // produced by an entity in the render view referenced by |render_view_id|. | |
| 116 void OnAssociateStreamWithProducer(int stream_id, int render_view_id); | |
| 117 | |
| 118 // Play the audio stream referenced by |stream_id|. | 117 // Play the audio stream referenced by |stream_id|. |
| 119 void OnPlayStream(int stream_id); | 118 void OnPlayStream(int stream_id); |
| 120 | 119 |
| 121 // Pause the audio stream referenced by |stream_id|. | 120 // Pause the audio stream referenced by |stream_id|. |
| 122 void OnPauseStream(int stream_id); | 121 void OnPauseStream(int stream_id); |
| 123 | 122 |
| 124 // Discard all audio data in stream referenced by |stream_id|. | 123 // Discard all audio data in stream referenced by |stream_id|. |
| 125 void OnFlushStream(int stream_id); | 124 void OnFlushStream(int stream_id); |
| 126 | 125 |
| 127 // Close the audio stream referenced by |stream_id|. | 126 // Close the audio stream referenced by |stream_id|. |
| 128 void OnCloseStream(int stream_id); | 127 void OnCloseStream(int stream_id); |
| 129 | 128 |
| 130 // Set the volume of the audio stream referenced by |stream_id|. | 129 // Set the volume of the audio stream referenced by |stream_id|. |
| 131 void OnSetVolume(int stream_id, double volume); | 130 void OnSetVolume(int stream_id, double volume); |
| 132 | 131 |
| 133 // Complete the process of creating an audio stream. This will set up the | 132 // Complete the process of creating an audio stream. This will set up the |
| 134 // shared memory or shared socket in low latency mode. | 133 // shared memory or shared socket in low latency mode and send the |
| 134 // NotifyStreamCreated message to the peer. |
| 135 void DoCompleteCreation(media::AudioOutputController* controller); | 135 void DoCompleteCreation(media::AudioOutputController* controller); |
| 136 | 136 |
| 137 // Send a state change message to the renderer. | 137 // Send a state change message to the renderer. |
| 138 void DoSendPlayingMessage(media::AudioOutputController* controller); | 138 void DoSendPlayingMessage(media::AudioOutputController* controller); |
| 139 void DoSendPausedMessage(media::AudioOutputController* controller); | 139 void DoSendPausedMessage(media::AudioOutputController* controller); |
| 140 void DoSendDeviceChangeMessage(media::AudioOutputController* controller, | 140 void DoSendDeviceChangeMessage(media::AudioOutputController* controller, |
| 141 int new_buffer_size, int new_sample_rate); | 141 int new_buffer_size, int new_sample_rate); |
| 142 | 142 |
| 143 // Handle error coming from audio stream. | 143 // Handle error coming from audio stream. |
| 144 void DoHandleError(media::AudioOutputController* controller, int error_code); | 144 void DoHandleError(media::AudioOutputController* controller, int error_code); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 // A map of stream IDs to audio sources. | 181 // A map of stream IDs to audio sources. |
| 182 AudioEntryMap audio_entries_; | 182 AudioEntryMap audio_entries_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 } // namespace content | 187 } // namespace content |
| 188 | 188 |
| 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |