OLD | NEW |
---|---|
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/renderer/media/media_stream_impl.h" | 5 #include "content/renderer/media/media_stream_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
723 bool notify_dispatcher) { | 723 bool notify_dispatcher) { |
724 MediaStreamSourceExtraData* extra_data = | 724 MediaStreamSourceExtraData* extra_data = |
725 static_cast<MediaStreamSourceExtraData*> (source.extraData()); | 725 static_cast<MediaStreamSourceExtraData*> (source.extraData()); |
726 CHECK(extra_data); | 726 CHECK(extra_data); |
727 DVLOG(1) << "MediaStreamImpl::StopLocalSource(" | 727 DVLOG(1) << "MediaStreamImpl::StopLocalSource(" |
728 << "{device_id = " << extra_data->device_info().device.id << "})"; | 728 << "{device_id = " << extra_data->device_info().device.id << "})"; |
729 | 729 |
730 if (source.type() == blink::WebMediaStreamSource::TypeAudio) { | 730 if (source.type() == blink::WebMediaStreamSource::TypeAudio) { |
731 if (extra_data->GetAudioCapturer()) { | 731 if (extra_data->GetAudioCapturer()) { |
732 extra_data->GetAudioCapturer()->Stop(); | 732 extra_data->GetAudioCapturer()->Stop(); |
733 | |
734 // Remove the capturer object from the WebRtcAudioDeviceImpl after it | |
735 // stops. | |
736 WebRtcAudioDeviceImpl* audio_device = | |
perkj_chrome
2014/01/14 08:42:40
What is the lifetime of audio_device? How about le
no longer working on chromium
2014/01/14 11:10:21
Sorry, I just forgot the save the change in this f
| |
737 dependency_factory_->GetWebRtcAudioDevice(); | |
738 if (audio_device) | |
739 audio_device->RemoveAudioCapturer(extra_data->GetAudioCapturer()); | |
733 } | 740 } |
734 } | 741 } |
735 | 742 |
736 if (notify_dispatcher) | 743 if (notify_dispatcher) |
737 media_stream_dispatcher_->StopStreamDevice(extra_data->device_info()); | 744 media_stream_dispatcher_->StopStreamDevice(extra_data->device_info()); |
738 | 745 |
739 blink::WebMediaStreamSource writable_source(source); | 746 blink::WebMediaStreamSource writable_source(source); |
740 writable_source.setReadyState( | 747 writable_source.setReadyState( |
741 blink::WebMediaStreamSource::ReadyStateEnded); | 748 blink::WebMediaStreamSource::ReadyStateEnded); |
742 writable_source.setExtraData(NULL); | 749 writable_source.setExtraData(NULL); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 RenderViewObserver::routing_id(), | 801 RenderViewObserver::routing_id(), |
795 session_id, | 802 session_id, |
796 buffer_size); | 803 buffer_size); |
797 } | 804 } |
798 | 805 |
799 bool MediaStreamImpl::GetAuthorizedDeviceInfoForAudioRenderer( | 806 bool MediaStreamImpl::GetAuthorizedDeviceInfoForAudioRenderer( |
800 int* session_id, | 807 int* session_id, |
801 int* output_sample_rate, | 808 int* output_sample_rate, |
802 int* output_frames_per_buffer) { | 809 int* output_frames_per_buffer) { |
803 DCHECK(CalledOnValidThread()); | 810 DCHECK(CalledOnValidThread()); |
804 | |
805 WebRtcAudioDeviceImpl* audio_device = | 811 WebRtcAudioDeviceImpl* audio_device = |
806 dependency_factory_->GetWebRtcAudioDevice(); | 812 dependency_factory_->GetWebRtcAudioDevice(); |
807 if (!audio_device) | 813 if (!audio_device) |
808 return false; | 814 return false; |
809 | 815 |
810 if (!audio_device->GetDefaultCapturer()) | 816 return audio_device->GetAuthorizedDeviceInfoForAudioRenderer( |
811 return false; | 817 session_id, output_sample_rate, output_frames_per_buffer); |
812 | |
813 return audio_device->GetDefaultCapturer()->GetPairedOutputParameters( | |
814 session_id, | |
815 output_sample_rate, | |
816 output_frames_per_buffer); | |
817 } | 818 } |
818 | 819 |
819 MediaStreamSourceExtraData::MediaStreamSourceExtraData( | 820 MediaStreamSourceExtraData::MediaStreamSourceExtraData( |
820 const StreamDeviceInfo& device_info, | 821 const StreamDeviceInfo& device_info, |
821 const SourceStopCallback& stop_callback) | 822 const SourceStopCallback& stop_callback) |
822 : device_info_(device_info), | 823 : device_info_(device_info), |
823 stop_callback_(stop_callback) { | 824 stop_callback_(stop_callback) { |
824 } | 825 } |
825 | 826 |
826 MediaStreamSourceExtraData::MediaStreamSourceExtraData() { | 827 MediaStreamSourceExtraData::MediaStreamSourceExtraData() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
862 enable_automatic_output_device_selection( | 863 enable_automatic_output_device_selection( |
863 enable_automatic_output_device_selection), | 864 enable_automatic_output_device_selection), |
864 frame(frame), | 865 frame(frame), |
865 request(request) { | 866 request(request) { |
866 } | 867 } |
867 | 868 |
868 MediaStreamImpl::UserMediaRequestInfo::~UserMediaRequestInfo() { | 869 MediaStreamImpl::UserMediaRequestInfo::~UserMediaRequestInfo() { |
869 } | 870 } |
870 | 871 |
871 } // namespace content | 872 } // namespace content |
OLD | NEW |