| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 7 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
| 8 #include "content/renderer/media/webrtc_audio_capturer.h" | 8 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 9 #include "content/renderer/media/webrtc_local_audio_source_provider.h" | 9 #include "content/renderer/media/webrtc_local_audio_source_provider.h" |
| 10 #include "content/renderer/media/webrtc_local_audio_track.h" | 10 #include "content/renderer/media/webrtc_local_audio_track.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 25 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 26 media::CHANNEL_LAYOUT_STEREO, 2, 0, 44100, 16, | 26 media::CHANNEL_LAYOUT_STEREO, 2, 0, 44100, 16, |
| 27 WebRtcLocalAudioSourceProvider::kWebAudioRenderBufferSize); | 27 WebRtcLocalAudioSourceProvider::kWebAudioRenderBufferSize); |
| 28 const int length = | 28 const int length = |
| 29 source_params_.frames_per_buffer() * source_params_.channels(); | 29 source_params_.frames_per_buffer() * source_params_.channels(); |
| 30 source_data_.reset(new int16[length]); | 30 source_data_.reset(new int16[length]); |
| 31 sink_bus_ = media::AudioBus::Create(sink_params_); | 31 sink_bus_ = media::AudioBus::Create(sink_params_); |
| 32 blink::WebMediaConstraints constraints; | 32 blink::WebMediaConstraints constraints; |
| 33 scoped_refptr<WebRtcAudioCapturer> capturer( | 33 scoped_refptr<WebRtcAudioCapturer> capturer( |
| 34 WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), | 34 WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), |
| 35 constraints, NULL)); | 35 constraints, NULL, NULL)); |
| 36 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( | 36 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( |
| 37 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); | 37 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); |
| 38 scoped_ptr<WebRtcLocalAudioTrack> native_track( | 38 scoped_ptr<WebRtcLocalAudioTrack> native_track( |
| 39 new WebRtcLocalAudioTrack(adapter, capturer, NULL)); | 39 new WebRtcLocalAudioTrack(adapter, capturer, NULL)); |
| 40 blink::WebMediaStreamSource audio_source; | 40 blink::WebMediaStreamSource audio_source; |
| 41 audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), | 41 audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), |
| 42 blink::WebMediaStreamSource::TypeAudio, | 42 blink::WebMediaStreamSource::TypeAudio, |
| 43 base::UTF8ToUTF16("dummy_source_name")); | 43 base::UTF8ToUTF16("dummy_source_name")); |
| 44 blink_track_.initialize(blink::WebString::fromUTF8("audio_track"), | 44 blink_track_.initialize(blink::WebString::fromUTF8("audio_track"), |
| 45 audio_source); | 45 audio_source); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Stop the audio track. | 128 // Stop the audio track. |
| 129 WebRtcLocalAudioTrack* native_track = static_cast<WebRtcLocalAudioTrack*>( | 129 WebRtcLocalAudioTrack* native_track = static_cast<WebRtcLocalAudioTrack*>( |
| 130 MediaStreamTrack::GetTrack(blink_track_)); | 130 MediaStreamTrack::GetTrack(blink_track_)); |
| 131 native_track->Stop(); | 131 native_track->Stop(); |
| 132 | 132 |
| 133 // Delete the source provider. | 133 // Delete the source provider. |
| 134 source_provider_.reset(); | 134 source_provider_.reset(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace content | 137 } // namespace content |
| OLD | NEW |