| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "base/ref_counted.h" | 60 #include "base/ref_counted.h" |
| 61 #include "base/scoped_ptr.h" | 61 #include "base/scoped_ptr.h" |
| 62 #include "base/shared_memory.h" | 62 #include "base/shared_memory.h" |
| 63 #include "content/browser/browser_message_filter.h" | 63 #include "content/browser/browser_message_filter.h" |
| 64 #include "content/browser/browser_thread.h" | 64 #include "content/browser/browser_thread.h" |
| 65 #include "media/audio/audio_io.h" | 65 #include "media/audio/audio_io.h" |
| 66 #include "media/audio/audio_output_controller.h" | 66 #include "media/audio/audio_output_controller.h" |
| 67 #include "media/audio/simple_sources.h" | 67 #include "media/audio/simple_sources.h" |
| 68 | 68 |
| 69 class AudioManager; | 69 class AudioManager; |
| 70 struct ViewHostMsg_Audio_CreateStream_Params; | 70 struct AudioParameters; |
| 71 | 71 |
| 72 class AudioRendererHost : public BrowserMessageFilter, | 72 class AudioRendererHost : public BrowserMessageFilter, |
| 73 public media::AudioOutputController::EventHandler { | 73 public media::AudioOutputController::EventHandler { |
| 74 public: | 74 public: |
| 75 typedef std::pair<int32, int> AudioEntryId; | 75 typedef std::pair<int32, int> AudioEntryId; |
| 76 | 76 |
| 77 struct AudioEntry { | 77 struct AudioEntry { |
| 78 AudioEntry(); | 78 AudioEntry(); |
| 79 ~AudioEntry(); | 79 ~AudioEntry(); |
| 80 | 80 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Methods called on IO thread. | 136 // Methods called on IO thread. |
| 137 // Returns true if the message is an audio related message and should be | 137 // Returns true if the message is an audio related message and should be |
| 138 // handled by this class. | 138 // handled by this class. |
| 139 bool IsAudioRendererHostMessage(const IPC::Message& message); | 139 bool IsAudioRendererHostMessage(const IPC::Message& message); |
| 140 | 140 |
| 141 // Audio related IPC message handlers. | 141 // Audio related IPC message handlers. |
| 142 // Creates an audio output stream with the specified format. If this call is | 142 // Creates an audio output stream with the specified format. If this call is |
| 143 // successful this object would keep an internal entry of the stream for the | 143 // successful this object would keep an internal entry of the stream for the |
| 144 // required properties. | 144 // required properties. |
| 145 void OnCreateStream(const IPC::Message& msg, int stream_id, | 145 void OnCreateStream(const IPC::Message& msg, int stream_id, |
| 146 const ViewHostMsg_Audio_CreateStream_Params& params, | 146 const AudioParameters& params, |
| 147 bool low_latency); | 147 bool low_latency); |
| 148 | 148 |
| 149 // Play the audio stream referenced by |stream_id|. | 149 // Play the audio stream referenced by |stream_id|. |
| 150 void OnPlayStream(const IPC::Message& msg, int stream_id); | 150 void OnPlayStream(const IPC::Message& msg, int stream_id); |
| 151 | 151 |
| 152 // Pause the audio stream referenced by |stream_id|. | 152 // Pause the audio stream referenced by |stream_id|. |
| 153 void OnPauseStream(const IPC::Message& msg, int stream_id); | 153 void OnPauseStream(const IPC::Message& msg, int stream_id); |
| 154 | 154 |
| 155 // Discard all audio data in stream referenced by |stream_id|. | 155 // Discard all audio data in stream referenced by |stream_id|. |
| 156 void OnFlushStream(const IPC::Message& msg, int stream_id); | 156 void OnFlushStream(const IPC::Message& msg, int stream_id); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // event is received. | 213 // event is received. |
| 214 AudioEntry* LookupByController(media::AudioOutputController* controller); | 214 AudioEntry* LookupByController(media::AudioOutputController* controller); |
| 215 | 215 |
| 216 // A map of id to audio sources. | 216 // A map of id to audio sources. |
| 217 AudioEntryMap audio_entries_; | 217 AudioEntryMap audio_entries_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 219 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 #endif // CONTENT_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ | 222 #endif // CONTENT_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |