| 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 void MediaStreamImpl::StopLocalSource( | 721 void MediaStreamImpl::StopLocalSource( |
| 722 const blink::WebMediaStreamSource& source, | 722 const blink::WebMediaStreamSource& source, |
| 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 } | 733 } |
| 735 | 734 |
| 736 if (notify_dispatcher) | 735 if (notify_dispatcher) |
| 737 media_stream_dispatcher_->StopStreamDevice(extra_data->device_info()); | 736 media_stream_dispatcher_->StopStreamDevice(extra_data->device_info()); |
| 738 | 737 |
| 739 blink::WebMediaStreamSource writable_source(source); | 738 blink::WebMediaStreamSource writable_source(source); |
| 740 writable_source.setReadyState( | 739 writable_source.setReadyState( |
| 741 blink::WebMediaStreamSource::ReadyStateEnded); | 740 blink::WebMediaStreamSource::ReadyStateEnded); |
| 742 writable_source.setExtraData(NULL); | 741 writable_source.setExtraData(NULL); |
| 743 } | 742 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 RenderViewObserver::routing_id(), | 793 RenderViewObserver::routing_id(), |
| 795 session_id, | 794 session_id, |
| 796 buffer_size); | 795 buffer_size); |
| 797 } | 796 } |
| 798 | 797 |
| 799 bool MediaStreamImpl::GetAuthorizedDeviceInfoForAudioRenderer( | 798 bool MediaStreamImpl::GetAuthorizedDeviceInfoForAudioRenderer( |
| 800 int* session_id, | 799 int* session_id, |
| 801 int* output_sample_rate, | 800 int* output_sample_rate, |
| 802 int* output_frames_per_buffer) { | 801 int* output_frames_per_buffer) { |
| 803 DCHECK(CalledOnValidThread()); | 802 DCHECK(CalledOnValidThread()); |
| 804 | |
| 805 WebRtcAudioDeviceImpl* audio_device = | 803 WebRtcAudioDeviceImpl* audio_device = |
| 806 dependency_factory_->GetWebRtcAudioDevice(); | 804 dependency_factory_->GetWebRtcAudioDevice(); |
| 807 if (!audio_device) | 805 if (!audio_device) |
| 808 return false; | 806 return false; |
| 809 | 807 |
| 810 if (!audio_device->GetDefaultCapturer()) | 808 return audio_device->GetAuthorizedDeviceInfoForAudioRenderer( |
| 811 return false; | 809 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 } | 810 } |
| 818 | 811 |
| 819 MediaStreamSourceExtraData::MediaStreamSourceExtraData( | 812 MediaStreamSourceExtraData::MediaStreamSourceExtraData( |
| 820 const StreamDeviceInfo& device_info, | 813 const StreamDeviceInfo& device_info, |
| 821 const SourceStopCallback& stop_callback) | 814 const SourceStopCallback& stop_callback) |
| 822 : device_info_(device_info), | 815 : device_info_(device_info), |
| 823 stop_callback_(stop_callback) { | 816 stop_callback_(stop_callback) { |
| 824 } | 817 } |
| 825 | 818 |
| 826 MediaStreamSourceExtraData::MediaStreamSourceExtraData() { | 819 MediaStreamSourceExtraData::MediaStreamSourceExtraData() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 enable_automatic_output_device_selection( | 855 enable_automatic_output_device_selection( |
| 863 enable_automatic_output_device_selection), | 856 enable_automatic_output_device_selection), |
| 864 frame(frame), | 857 frame(frame), |
| 865 request(request) { | 858 request(request) { |
| 866 } | 859 } |
| 867 | 860 |
| 868 MediaStreamImpl::UserMediaRequestInfo::~UserMediaRequestInfo() { | 861 MediaStreamImpl::UserMediaRequestInfo::~UserMediaRequestInfo() { |
| 869 } | 862 } |
| 870 | 863 |
| 871 } // namespace content | 864 } // namespace content |
| OLD | NEW |