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

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

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix various compiler errors Created 8 years, 9 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 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 11 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
12 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" 12 #include "content/browser/renderer_host/media/audio_input_sync_writer.h"
13 #include "content/browser/renderer_host/media/media_stream_manager.h" 13 #include "content/browser/renderer_host/media/media_stream_manager.h"
14 #include "content/common/media/audio_messages.h" 14 #include "content/common/media/audio_messages.h"
15 15
16 using content::BrowserMessageFilter; 16 using content::BrowserMessageFilter;
17 using content::BrowserThread; 17 using content::BrowserThread;
18 18
19 AudioInputRendererHost::AudioEntry::AudioEntry() 19 AudioInputRendererHost::AudioEntry::AudioEntry()
20 : stream_id(0), 20 : stream_id(0),
21 pending_close(false) { 21 pending_close(false) {
22 } 22 }
23 23
24 AudioInputRendererHost::AudioEntry::~AudioEntry() {} 24 AudioInputRendererHost::AudioEntry::~AudioEntry() {}
25 25
26 AudioInputRendererHost::AudioInputRendererHost( 26 AudioInputRendererHost::AudioInputRendererHost(
27 content::ResourceContext* resource_context, 27 content::ResourceContext* resource_context,
28 AudioManager* audio_manager) 28 media::AudioManager* audio_manager)
29 : resource_context_(resource_context), 29 : resource_context_(resource_context),
30 audio_manager_(audio_manager) { 30 audio_manager_(audio_manager) {
31 } 31 }
32 32
33 AudioInputRendererHost::~AudioInputRendererHost() { 33 AudioInputRendererHost::~AudioInputRendererHost() {
34 DCHECK(audio_entries_.empty()); 34 DCHECK(audio_entries_.empty());
35 } 35 }
36 36
37 void AudioInputRendererHost::OnChannelClosing() { 37 void AudioInputRendererHost::OnChannelClosing() {
38 BrowserMessageFilter::OnChannelClosing(); 38 BrowserMessageFilter::OnChannelClosing();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 resource_context_, audio_manager_)->audio_input_device_manager(); 191 resource_context_, audio_manager_)->audio_input_device_manager();
192 192
193 // Add the session entry to the map. 193 // Add the session entry to the map.
194 session_entries_[session_id] = stream_id; 194 session_entries_[session_id] = stream_id;
195 195
196 // Start the device with the session_id. If the device is started 196 // Start the device with the session_id. If the device is started
197 // successfully, OnDeviceStarted() callback will be triggered. 197 // successfully, OnDeviceStarted() callback will be triggered.
198 audio_input_man->Start(session_id, this); 198 audio_input_man->Start(session_id, this);
199 } 199 }
200 200
201 void AudioInputRendererHost::OnCreateStream(int stream_id, 201 void AudioInputRendererHost::OnCreateStream(
202 const AudioParameters& params, 202 int stream_id, const media::AudioParameters& params,
203 const std::string& device_id) { 203 const std::string& device_id) {
204 VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id=" 204 VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id="
205 << stream_id << ")"; 205 << stream_id << ")";
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
207 DCHECK(LookupById(stream_id) == NULL); 207 DCHECK(LookupById(stream_id) == NULL);
208 208
209 AudioParameters audio_params(params); 209 media::AudioParameters audio_params(params);
210 210
211 DCHECK_GT(audio_params.frames_per_buffer(), 0); 211 DCHECK_GT(audio_params.frames_per_buffer(), 0);
212 uint32 buffer_size = audio_params.GetBytesPerBuffer(); 212 uint32 buffer_size = audio_params.GetBytesPerBuffer();
213 213
214 // Create a new AudioEntry structure. 214 // Create a new AudioEntry structure.
215 scoped_ptr<AudioEntry> entry(new AudioEntry()); 215 scoped_ptr<AudioEntry> entry(new AudioEntry());
216 216
217 // Create the shared memory and share it with the renderer process 217 // Create the shared memory and share it with the renderer process
218 // using a new SyncWriter object. 218 // using a new SyncWriter object.
219 if (!entry->shared_memory.CreateAndMapAnonymous(buffer_size)) { 219 if (!entry->shared_memory.CreateAndMapAnonymous(buffer_size)) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
438 438
439 for (SessionEntryMap::iterator it = session_entries_.begin(); 439 for (SessionEntryMap::iterator it = session_entries_.begin();
440 it != session_entries_.end(); ++it) { 440 it != session_entries_.end(); ++it) {
441 if (stream_id == it->second) { 441 if (stream_id == it->second) {
442 return it->first; 442 return it->first;
443 } 443 }
444 } 444 }
445 return 0; 445 return 0;
446 } 446 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698