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

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

Issue 10912004: Begin adding support for tab mirroring via the MediaStream audio/video capturing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add CONTENT_EXPORT to resolve linker issues on components builds. Also, IWYU. Created 8 years, 3 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 #include "content/public/common/media_stream_request.h"
15 16
16 using content::BrowserMessageFilter; 17 using content::BrowserMessageFilter;
17 using content::BrowserThread; 18 using content::BrowserThread;
18 19
19 AudioInputRendererHost::AudioEntry::AudioEntry() 20 AudioInputRendererHost::AudioEntry::AudioEntry()
20 : stream_id(0), 21 : stream_id(0),
21 pending_close(false) { 22 pending_close(false) {
22 } 23 }
23 24
24 AudioInputRendererHost::AudioEntry::~AudioEntry() {} 25 AudioInputRendererHost::AudioEntry::~AudioEntry() {}
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 174 }
174 void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) { 175 void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) {
175 VLOG(1) << "AudioInputRendererHost::OnStartDevice(stream_id=" 176 VLOG(1) << "AudioInputRendererHost::OnStartDevice(stream_id="
176 << stream_id << ", session_id = " << session_id << ")"; 177 << stream_id << ", session_id = " << session_id << ")";
177 178
178 // Add the session entry to the map. 179 // Add the session entry to the map.
179 session_entries_[session_id] = stream_id; 180 session_entries_[session_id] = stream_id;
180 181
181 // Start the device with the session_id. If the device is started 182 // Start the device with the session_id. If the device is started
182 // successfully, OnDeviceStarted() callback will be triggered. 183 // successfully, OnDeviceStarted() callback will be triggered.
183 media_stream_manager_->audio_input_device_manager()->Start(session_id, this); 184 media_stream_manager_->GetAudioInputDeviceManager(
185 content::MEDIA_STREAM_DEVICE_TYPE_USER_AUDIO_CAPTURE)->
186 Start(session_id, this);
187 // TODO(miu): Confirm use of AudioInputHostMsg_* only applies to the user
188 // audio capture devices, and does not have anything to do with
189 // MediaStreamHostMsg_*.
184 } 190 }
185 191
186 void AudioInputRendererHost::OnCreateStream( 192 void AudioInputRendererHost::OnCreateStream(
187 int stream_id, const media::AudioParameters& params, 193 int stream_id, const media::AudioParameters& params,
188 const std::string& device_id, bool automatic_gain_control) { 194 const std::string& device_id, bool automatic_gain_control) {
189 VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id=" 195 VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id="
190 << stream_id << ")"; 196 << stream_id << ")";
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
192 DCHECK(LookupById(stream_id) == NULL); 198 DCHECK(LookupById(stream_id) == NULL);
193 199
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 stream_id, media::AudioInputIPCDelegate::kStopped)); 336 stream_id, media::AudioInputIPCDelegate::kStopped));
331 } 337 }
332 338
333 // Delete the session entry. 339 // Delete the session entry.
334 session_entries_.erase(it); 340 session_entries_.erase(it);
335 } 341 }
336 342
337 void AudioInputRendererHost::StopAndDeleteDevice(int session_id) { 343 void AudioInputRendererHost::StopAndDeleteDevice(int session_id) {
338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
339 345
340 media_stream_manager_->audio_input_device_manager()->Stop(session_id); 346 media_stream_manager_->GetAudioInputDeviceManager(
347 content::MEDIA_STREAM_DEVICE_TYPE_USER_AUDIO_CAPTURE)->Stop(session_id);
341 348
342 // Delete the session entry. 349 // Delete the session entry.
343 session_entries_.erase(session_id); 350 session_entries_.erase(session_id);
344 } 351 }
345 352
346 void AudioInputRendererHost::CloseAndDeleteStream(AudioEntry* entry) { 353 void AudioInputRendererHost::CloseAndDeleteStream(AudioEntry* entry) {
347 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 354 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
348 355
349 if (!entry->pending_close) { 356 if (!entry->pending_close) {
350 entry->controller->Close(base::Bind(&AudioInputRendererHost::DeleteEntry, 357 entry->controller->Close(base::Bind(&AudioInputRendererHost::DeleteEntry,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
401 408
402 for (SessionEntryMap::iterator it = session_entries_.begin(); 409 for (SessionEntryMap::iterator it = session_entries_.begin();
403 it != session_entries_.end(); ++it) { 410 it != session_entries_.end(); ++it) {
404 if (stream_id == it->second) { 411 if (stream_id == it->second) {
405 return it->first; 412 return it->first;
406 } 413 }
407 } 414 }
408 return 0; 415 return 0;
409 } 416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698