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

Unified Diff: content/renderer/media/media_stream_dependency_factory.cc

Issue 12440027: Do not pass the string device_id via IPC message to create an audio input stream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Per's comments. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_dependency_factory.cc
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index c6df648a4846dd93b582fb366dca1161f471d001..06943a6bb2da00c58b1fc460567b7e843a0d83f1 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -462,7 +462,11 @@ MediaStreamDependencyFactory::CreateLocalVideoSource(
bool MediaStreamDependencyFactory::InitializeAudioSource(
const StreamDeviceInfo& device_info) {
DVLOG(1) << "MediaStreamDependencyFactory::InitializeAudioSource()";
- const MediaStreamDevice device = device_info.device;
+
+ // TODO(henrika): the current design does not support a unique source
+ // for each audio track.
+ if (device_info.session_id <= 0)
+ return false;
// Initialize the source using audio parameters for the selected
// capture device.
@@ -470,18 +474,10 @@ bool MediaStreamDependencyFactory::InitializeAudioSource(
// TODO(henrika): refactor \content\public\common\media_stream_request.h
// to allow dependency of media::ChannelLayout and avoid static_cast.
if (!capturer->Initialize(
- static_cast<media::ChannelLayout>(device.channel_layout),
- device.sample_rate))
- return false;
-
- // Specify which capture device to use. The acquired session id is used
- // for identification.
- // TODO(henrika): the current design does not support a uniqe source
- // for each audio track.
- if (device_info.session_id <= 0)
+ static_cast<media::ChannelLayout>(device_info.device.channel_layout),
+ device_info.device.sample_rate, device_info.session_id))
return false;
- capturer->SetDevice(device_info.session_id);
return true;
}
@@ -555,6 +551,21 @@ MediaStreamDependencyFactory::GetWebRtcAudioDevice() {
return audio_device_;
}
+void MediaStreamDependencyFactory::StopLocalAudioSource(
+ const WebKit::WebMediaStream& description) {
+ MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>(
+ description.extraData());
+ if (extra_data && extra_data->is_local() && extra_data->stream() &&
+ !extra_data->stream()->GetAudioTracks().empty()) {
+ if (GetWebRtcAudioDevice()) {
+ scoped_refptr<WebRtcAudioCapturer> capturer =
+ GetWebRtcAudioDevice()->capturer();
+ if (capturer)
+ capturer->Stop();
+ }
+ }
+}
+
void MediaStreamDependencyFactory::InitializeWorkerThread(
talk_base::Thread** thread,
base::WaitableEvent* event) {
« no previous file with comments | « content/renderer/media/media_stream_dependency_factory.h ('k') | content/renderer/media/media_stream_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698