Chromium Code Reviews| Index: content/renderer/media/media_stream_impl.cc |
| diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc |
| index f659aaf9c93188385bbe257acea278284f1033cc..d692de638de64936a9cf2608788b43950a56dd1a 100644 |
| --- a/content/renderer/media/media_stream_impl.cc |
| +++ b/content/renderer/media/media_stream_impl.cc |
| @@ -730,6 +730,13 @@ void MediaStreamImpl::StopLocalSource( |
| if (source.type() == blink::WebMediaStreamSource::TypeAudio) { |
| if (extra_data->GetAudioCapturer()) { |
| extra_data->GetAudioCapturer()->Stop(); |
| + |
| + // Remove the capturer object from the WebRtcAudioDeviceImpl after it |
| + // stops. |
| + WebRtcAudioDeviceImpl* audio_device = |
|
perkj_chrome
2014/01/12 21:53:06
Can this be moved to AudioCapturer::Stop instead?
|
| + dependency_factory_->GetWebRtcAudioDevice(); |
| + if (audio_device) |
| + audio_device->RemoveAudioCapturer(extra_data->GetAudioCapturer()); |
| } |
| } |
| @@ -802,18 +809,33 @@ bool MediaStreamImpl::GetAuthorizedDeviceInfoForAudioRenderer( |
| int* output_frames_per_buffer) { |
| DCHECK(CalledOnValidThread()); |
| - WebRtcAudioDeviceImpl* audio_device = |
| - dependency_factory_->GetWebRtcAudioDevice(); |
| - if (!audio_device) |
| - return false; |
| + // Loop through the sources and find out the capturer that can provide |
| + // the paired device information for the audio renderer. |
| + scoped_refptr<WebRtcAudioCapturer> capturer; |
| + for (LocalStreamSources::const_iterator it = local_sources_.begin(); |
|
perkj_chrome
2014/01/12 21:53:06
This is kind of backwards. We moved this info to t
no longer working on chromium
2014/01/13 16:59:59
Done.
|
| + it != local_sources_.end(); ++it) { |
| + MediaStreamSourceExtraData* extra_data = |
| + static_cast<MediaStreamSourceExtraData*>(it->source.extraData()); |
| + if (it->source.type() == blink::WebMediaStreamSource::TypeAudio && |
| + extra_data->GetAudioCapturer() && |
| + !extra_data->GetAudioCapturer()->device_id().empty()) { |
|
perkj_chrome
2014/01/12 21:53:06
GetAudioCapturer()->device_id().empty() ?
Can thi
no longer working on chromium
2014/01/13 16:59:59
Remove now.
|
| + // If there are more than one open capture devices, return false because |
| + // we have no way to pick an appropriate device. |
| + if (capturer) { |
| + DLOG(WARNING) << "Failed to get the authorized paired playout device " |
| + << "since there are more than one open capture devices."; |
| + return false; |
| + } |
| + capturer = extra_data->GetAudioCapturer(); |
| + } |
| + } |
| - if (!audio_device->GetDefaultCapturer()) |
| + if (!capturer) |
| return false; |
| - return audio_device->GetDefaultCapturer()->GetPairedOutputParameters( |
| - session_id, |
| - output_sample_rate, |
| - output_frames_per_buffer); |
| + return capturer->GetPairedOutputParameters(session_id, |
| + output_sample_rate, |
| + output_frames_per_buffer); |
| } |
| MediaStreamSourceExtraData::MediaStreamSourceExtraData( |