| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); | 86 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); |
| 87 | 87 |
| 88 class AudioEntry; | 88 class AudioEntry; |
| 89 typedef std::map<int, AudioEntry*> AudioEntryMap; | 89 typedef std::map<int, AudioEntry*> AudioEntryMap; |
| 90 | 90 |
| 91 virtual ~AudioRendererHost(); | 91 virtual ~AudioRendererHost(); |
| 92 | 92 |
| 93 // Methods called on IO thread ---------------------------------------------- | 93 // Methods called on IO thread ---------------------------------------------- |
| 94 | 94 |
| 95 // Audio related IPC message handlers. | 95 // Audio related IPC message handlers. |
| 96 // Creates an audio output stream with the specified format. If this call is | 96 |
| 97 // successful this object would keep an internal entry of the stream for the | 97 // Creates an audio output stream with the specified format whose data is |
| 98 // required properties. | 98 // produced by an entity in the render view referenced by |render_view_id|. |
| 99 // Upon success/failure, the peer is notified via the NotifyStreamCreated |
| 100 // message. |
| 99 void OnCreateStream(int stream_id, | 101 void OnCreateStream(int stream_id, |
| 102 int render_view_id, |
| 100 const media::AudioParameters& params); | 103 const media::AudioParameters& params); |
| 101 | 104 |
| 102 // Track that the data for the audio stream referenced by |stream_id| is | |
| 103 // produced by an entity in the render view referenced by |render_view_id|. | |
| 104 void OnAssociateStreamWithProducer(int stream_id, int render_view_id); | |
| 105 | |
| 106 // Play the audio stream referenced by |stream_id|. | 105 // Play the audio stream referenced by |stream_id|. |
| 107 void OnPlayStream(int stream_id); | 106 void OnPlayStream(int stream_id); |
| 108 | 107 |
| 109 // Pause the audio stream referenced by |stream_id|. | 108 // Pause the audio stream referenced by |stream_id|. |
| 110 void OnPauseStream(int stream_id); | 109 void OnPauseStream(int stream_id); |
| 111 | 110 |
| 112 // Close the audio stream referenced by |stream_id|. | 111 // Close the audio stream referenced by |stream_id|. |
| 113 void OnCloseStream(int stream_id); | 112 void OnCloseStream(int stream_id); |
| 114 | 113 |
| 115 // Set the volume of the audio stream referenced by |stream_id|. | 114 // Set the volume of the audio stream referenced by |stream_id|. |
| 116 void OnSetVolume(int stream_id, double volume); | 115 void OnSetVolume(int stream_id, double volume); |
| 117 | 116 |
| 118 // Complete the process of creating an audio stream. This will set up the | 117 // Complete the process of creating an audio stream. This will set up the |
| 119 // shared memory or shared socket in low latency mode. | 118 // shared memory or shared socket in low latency mode and send the |
| 119 // NotifyStreamCreated message to the peer. |
| 120 void DoCompleteCreation(AudioEntry* entry); | 120 void DoCompleteCreation(AudioEntry* entry); |
| 121 | 121 |
| 122 // Propagate audible signal to MediaObserver. | 122 // Propagate audible signal to MediaObserver. |
| 123 void DoNotifyAudibleState(AudioEntry* entry, bool is_audible); | 123 void DoNotifyAudibleState(AudioEntry* entry, bool is_audible); |
| 124 | 124 |
| 125 // Send an error message to the renderer. | 125 // Send an error message to the renderer. |
| 126 void SendErrorMessage(int stream_id); | 126 void SendErrorMessage(int stream_id); |
| 127 | 127 |
| 128 // Delete an audio entry, notifying observers first. This is called by | 128 // Delete an audio entry, notifying observers first. This is called by |
| 129 // AudioOutputController after it has closed. | 129 // AudioOutputController after it has closed. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 145 | 145 |
| 146 // A map of stream IDs to audio sources. | 146 // A map of stream IDs to audio sources. |
| 147 AudioEntryMap audio_entries_; | 147 AudioEntryMap audio_entries_; |
| 148 | 148 |
| 149 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 149 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 } // namespace content | 152 } // namespace content |
| 153 | 153 |
| 154 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 154 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |