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) { |