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

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

Issue 11166002: Plumb render view ID from audio-related code in renderer through IPCs to AudioRendererHost in brows… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed tommi's comments and rebased. Created 8 years, 2 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"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 << stream_id << ", session_id = " << session_id << ")"; 176 << stream_id << ", session_id = " << session_id << ")";
177 177
178 // Add the session entry to the map. 178 // Add the session entry to the map.
179 session_entries_[session_id] = stream_id; 179 session_entries_[session_id] = stream_id;
180 180
181 // Start the device with the session_id. If the device is started 181 // Start the device with the session_id. If the device is started
182 // successfully, OnDeviceStarted() callback will be triggered. 182 // successfully, OnDeviceStarted() callback will be triggered.
183 media_stream_manager_->audio_input_device_manager()->Start(session_id, this); 183 media_stream_manager_->audio_input_device_manager()->Start(session_id, this);
184 } 184 }
185 185
186 // TODO(miu): AudioInputRendererHost will keep track of the render_view_id
187 // associated with the created audio stream in a soon-upcoming change.
186 void AudioInputRendererHost::OnCreateStream( 188 void AudioInputRendererHost::OnCreateStream(
187 int stream_id, const media::AudioParameters& params, 189 int render_view_id, int stream_id, const media::AudioParameters& params,
188 const std::string& device_id, bool automatic_gain_control) { 190 const std::string& device_id, bool automatic_gain_control) {
189 VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id="
190 << stream_id << ")";
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
192 DCHECK(LookupById(stream_id) == NULL); 192 DCHECK(LookupById(stream_id) == NULL);
193 193
194 // TODO(miu): There is still code in the renderer which has been stubbed out,
195 // and should be implemented to plumb in the source render_view_id. In debug
196 // mode, log a WARNING until this is resolved.
197 DLOG_IF(WARNING, render_view_id <= 0)
198 << ("FIXME: AudioInputRendererHost::OnCreateStream called with unknown "
199 "render view.");
200 VLOG(1) << "AudioInputRendererHost@" << this
Chris Rogers 2012/10/17 20:43:11 shouldn't this be a DVLOG?
miu 2012/10/17 22:06:30 Done.
201 << "::OnCreateStream(render_view_id=" << render_view_id
202 << ", stream_id=" << stream_id << ")";
203
194 media::AudioParameters audio_params(params); 204 media::AudioParameters audio_params(params);
195 205
196 DCHECK_GT(audio_params.frames_per_buffer(), 0); 206 DCHECK_GT(audio_params.frames_per_buffer(), 0);
197 uint32 buffer_size = audio_params.GetBytesPerBuffer(); 207 uint32 buffer_size = audio_params.GetBytesPerBuffer();
198 208
199 // Create a new AudioEntry structure. 209 // Create a new AudioEntry structure.
200 scoped_ptr<AudioEntry> entry(new AudioEntry()); 210 scoped_ptr<AudioEntry> entry(new AudioEntry());
201 211
202 uint32 mem_size = sizeof(media::AudioInputBufferParameters) + buffer_size; 212 uint32 mem_size = sizeof(media::AudioInputBufferParameters) + buffer_size;
203 213
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 410 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
401 411
402 for (SessionEntryMap::iterator it = session_entries_.begin(); 412 for (SessionEntryMap::iterator it = session_entries_.begin();
403 it != session_entries_.end(); ++it) { 413 it != session_entries_.end(); ++it) {
404 if (stream_id == it->second) { 414 if (stream_id == it->second) {
405 return it->first; 415 return it->first;
406 } 416 }
407 } 417 }
408 return 0; 418 return 0;
409 } 419 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698