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 24 matching lines...) Expand all Loading... |
35 // A SyncSocket pair is used to signal buffer readiness between processes. | 35 // A SyncSocket pair is used to signal buffer readiness between processes. |
36 | 36 |
37 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 37 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
38 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 38 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
39 | 39 |
40 #include <map> | 40 #include <map> |
41 | 41 |
42 #include "base/gtest_prod_util.h" | 42 #include "base/gtest_prod_util.h" |
43 #include "base/memory/ref_counted.h" | 43 #include "base/memory/ref_counted.h" |
44 #include "base/memory/scoped_ptr.h" | 44 #include "base/memory/scoped_ptr.h" |
45 #include "base/memory/shared_memory.h" | |
46 #include "base/process.h" | 45 #include "base/process.h" |
47 #include "base/sequenced_task_runner_helpers.h" | 46 #include "base/sequenced_task_runner_helpers.h" |
48 #include "content/common/content_export.h" | 47 #include "content/common/content_export.h" |
49 #include "content/public/browser/browser_message_filter.h" | 48 #include "content/public/browser/browser_message_filter.h" |
50 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
51 #include "media/audio/audio_io.h" | 50 #include "media/audio/audio_io.h" |
52 #include "media/audio/audio_output_controller.h" | 51 #include "media/audio/audio_output_controller.h" |
53 #include "media/audio/simple_sources.h" | 52 #include "media/audio/simple_sources.h" |
54 | 53 |
55 namespace media { | 54 namespace media { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 115 |
117 // Close the audio stream referenced by |stream_id|. | 116 // Close the audio stream referenced by |stream_id|. |
118 void OnCloseStream(int stream_id); | 117 void OnCloseStream(int stream_id); |
119 | 118 |
120 // Set the volume of the audio stream referenced by |stream_id|. | 119 // Set the volume of the audio stream referenced by |stream_id|. |
121 void OnSetVolume(int stream_id, double volume); | 120 void OnSetVolume(int stream_id, double volume); |
122 | 121 |
123 // Complete the process of creating an audio stream. This will set up the | 122 // Complete the process of creating an audio stream. This will set up the |
124 // shared memory or shared socket in low latency mode and send the | 123 // shared memory or shared socket in low latency mode and send the |
125 // NotifyStreamCreated message to the peer. | 124 // NotifyStreamCreated message to the peer. |
126 void DoCompleteCreation(AudioEntry* entry); | 125 void DoCompleteCreation(int stream_id); |
127 | 126 |
128 // Propagate audible signal to MediaObserver. | 127 // Propagate measured power level of the audio signal to MediaObserver. |
129 void DoNotifyAudibleState(AudioEntry* entry, bool is_audible); | 128 void DoNotifyAudioPowerLevel(int stream_id, float power_dbfs, bool clipped); |
130 | 129 |
131 // Send an error message to the renderer. | 130 // Send an error message to the renderer. |
132 void SendErrorMessage(int stream_id); | 131 void SendErrorMessage(int stream_id); |
133 | 132 |
134 // Delete an audio entry, notifying observers first. This is called by | 133 // Delete an audio entry, notifying observers first. This is called by |
135 // AudioOutputController after it has closed. | 134 // AudioOutputController after it has closed. |
136 void DeleteEntry(scoped_ptr<AudioEntry> entry); | 135 void DeleteEntry(scoped_ptr<AudioEntry> entry); |
137 | 136 |
138 // Send an error message to the renderer, then close the stream. | 137 // Send an error message to the renderer, then close the stream. |
139 void ReportErrorAndClose(int stream_id); | 138 void ReportErrorAndClose(int stream_id); |
(...skipping 14 matching lines...) Expand all Loading... |
154 | 153 |
155 // A map of stream IDs to audio sources. | 154 // A map of stream IDs to audio sources. |
156 AudioEntryMap audio_entries_; | 155 AudioEntryMap audio_entries_; |
157 | 156 |
158 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 157 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
159 }; | 158 }; |
160 | 159 |
161 } // namespace content | 160 } // namespace content |
162 | 161 |
163 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 162 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |