Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: content/browser/renderer_host/media/audio_input_renderer_host.h

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // AudioInputRendererHost serves audio related requests from audio capturer 5 // AudioInputRendererHost serves audio related requests from audio capturer
6 // which lives inside the render process and provide access to audio hardware. 6 // which lives inside the render process and provide access to audio hardware.
7 // 7 //
8 // Create stream sequence (AudioInputController = AIC): 8 // Create stream sequence (AudioInputController = AIC):
9 // 9 //
10 // AudioInputHostMsg_CreateStream -> OnCreateStream -> AIC::CreateLowLatency -> 10 // AudioInputHostMsg_CreateStream -> OnCreateStream -> AIC::CreateLowLatency ->
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "content/public/browser/browser_message_filter.h" 61 #include "content/public/browser/browser_message_filter.h"
62 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
63 #include "media/audio/audio_input_controller.h" 63 #include "media/audio/audio_input_controller.h"
64 #include "media/audio/audio_io.h" 64 #include "media/audio/audio_io.h"
65 #include "media/audio/simple_sources.h" 65 #include "media/audio/simple_sources.h"
66 66
67 namespace content { 67 namespace content {
68 class ResourceContext; 68 class ResourceContext;
69 } 69 }
70 70
71 namespace media {
71 class AudioManager; 72 class AudioManager;
72 class AudioParameters; 73 class AudioParameters;
74 }
73 75
74 class CONTENT_EXPORT AudioInputRendererHost 76 class CONTENT_EXPORT AudioInputRendererHost
75 : public content::BrowserMessageFilter, 77 : public content::BrowserMessageFilter,
76 public media::AudioInputController::EventHandler, 78 public media::AudioInputController::EventHandler,
77 public media_stream::AudioInputDeviceManagerEventHandler { 79 public media_stream::AudioInputDeviceManagerEventHandler {
78 public: 80 public:
79 struct AudioEntry { 81 struct AudioEntry {
80 AudioEntry(); 82 AudioEntry();
81 ~AudioEntry(); 83 ~AudioEntry();
82 84
83 // The AudioInputController that manages the audio input stream. 85 // The AudioInputController that manages the audio input stream.
84 scoped_refptr<media::AudioInputController> controller; 86 scoped_refptr<media::AudioInputController> controller;
85 87
86 // The audio input stream ID in the render view. 88 // The audio input stream ID in the render view.
87 int stream_id; 89 int stream_id;
88 90
89 // Shared memory for transmission of the audio data. 91 // Shared memory for transmission of the audio data.
90 base::SharedMemory shared_memory; 92 base::SharedMemory shared_memory;
91 93
92 // The synchronous writer to be used by the controller. We have the 94 // The synchronous writer to be used by the controller. We have the
93 // ownership of the writer. 95 // ownership of the writer.
94 scoped_ptr<media::AudioInputController::SyncWriter> writer; 96 scoped_ptr<media::AudioInputController::SyncWriter> writer;
95 97
96 // Set to true after we called Close() for the controller. 98 // Set to true after we called Close() for the controller.
97 bool pending_close; 99 bool pending_close;
98 }; 100 };
99 101
100 // Called from UI thread from the owner of this object. 102 // Called from UI thread from the owner of this object.
101 AudioInputRendererHost(content::ResourceContext* resource_context, 103 AudioInputRendererHost(content::ResourceContext* resource_context,
102 AudioManager* audio_manager); 104 media::AudioManager* audio_manager);
103 105
104 // content::BrowserMessageFilter implementation. 106 // content::BrowserMessageFilter implementation.
105 virtual void OnChannelClosing() OVERRIDE; 107 virtual void OnChannelClosing() OVERRIDE;
106 virtual void OnDestruct() const OVERRIDE; 108 virtual void OnDestruct() const OVERRIDE;
107 virtual bool OnMessageReceived(const IPC::Message& message, 109 virtual bool OnMessageReceived(const IPC::Message& message,
108 bool* message_was_ok) OVERRIDE; 110 bool* message_was_ok) OVERRIDE;
109 111
110 // AudioInputController::EventHandler implementation. 112 // AudioInputController::EventHandler implementation.
111 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE; 113 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE;
112 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE; 114 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE;
(...skipping 19 matching lines...) Expand all
132 134
133 // Start the audio input device with the session id. If the device 135 // Start the audio input device with the session id. If the device
134 // starts successfully, it will trigger OnDeviceStarted() callback. 136 // starts successfully, it will trigger OnDeviceStarted() callback.
135 void OnStartDevice(int stream_id, int session_id); 137 void OnStartDevice(int stream_id, int session_id);
136 138
137 // Audio related IPC message handlers. 139 // Audio related IPC message handlers.
138 // Creates an audio input stream with the specified format. If this call is 140 // Creates an audio input stream with the specified format. If this call is
139 // successful this object would keep an internal entry of the stream for the 141 // successful this object would keep an internal entry of the stream for the
140 // required properties. 142 // required properties.
141 void OnCreateStream(int stream_id, 143 void OnCreateStream(int stream_id,
142 const AudioParameters& params, 144 const media::AudioParameters& params,
143 const std::string& device_id, 145 const std::string& device_id,
144 bool automatic_gain_control); 146 bool automatic_gain_control);
145 147
146 // Record the audio input stream referenced by |stream_id|. 148 // Record the audio input stream referenced by |stream_id|.
147 void OnRecordStream(int stream_id); 149 void OnRecordStream(int stream_id);
148 150
149 // Close the audio stream referenced by |stream_id|. 151 // Close the audio stream referenced by |stream_id|.
150 void OnCloseStream(int stream_id); 152 void OnCloseStream(int stream_id);
151 153
152 // Set the volume of the audio stream referenced by |stream_id|. 154 // Set the volume of the audio stream referenced by |stream_id|.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // This method is used to look up an AudioEntry after a controller 192 // This method is used to look up an AudioEntry after a controller
191 // event is received. 193 // event is received.
192 AudioEntry* LookupByController(media::AudioInputController* controller); 194 AudioEntry* LookupByController(media::AudioInputController* controller);
193 195
194 // A helper method to look up a session identified by |stream_id|. 196 // A helper method to look up a session identified by |stream_id|.
195 // Returns 0 if not found. 197 // Returns 0 if not found.
196 int LookupSessionById(int stream_id); 198 int LookupSessionById(int stream_id);
197 199
198 // Used to get an instance of AudioInputDeviceManager. 200 // Used to get an instance of AudioInputDeviceManager.
199 content::ResourceContext* resource_context_; 201 content::ResourceContext* resource_context_;
200 AudioManager* audio_manager_; 202 media::AudioManager* audio_manager_;
201 203
202 // A map of stream IDs to audio sources. 204 // A map of stream IDs to audio sources.
203 typedef std::map<int, AudioEntry*> AudioEntryMap; 205 typedef std::map<int, AudioEntry*> AudioEntryMap;
204 AudioEntryMap audio_entries_; 206 AudioEntryMap audio_entries_;
205 207
206 // A map of session IDs to audio session sources. 208 // A map of session IDs to audio session sources.
207 typedef std::map<int, int> SessionEntryMap; 209 typedef std::map<int, int> SessionEntryMap;
208 SessionEntryMap session_entries_; 210 SessionEntryMap session_entries_;
209 211
210 DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost); 212 DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost);
211 }; 213 };
212 214
213 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_RENDERER_HOST_H_ 215 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_RENDERER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698