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/mock_media_constraint_factory.h" | 7 #include "content/renderer/media/mock_media_constraint_factory.h" |
8 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 8 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
9 #include "content/renderer/media/webrtc_audio_capturer.h" | 9 #include "content/renderer/media/webrtc_audio_capturer.h" |
10 #include "content/renderer/media/webrtc_local_audio_source_provider.h" | 10 #include "content/renderer/media/webrtc_local_audio_source_provider.h" |
(...skipping 19 matching lines...) Expand all Loading... |
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 MockMediaConstraintFactory constraint_factory; | 32 MockMediaConstraintFactory constraint_factory; |
33 scoped_refptr<WebRtcAudioCapturer> capturer( | 33 scoped_refptr<WebRtcAudioCapturer> capturer( |
34 WebRtcAudioCapturer::CreateCapturer( | 34 WebRtcAudioCapturer::CreateCapturer( |
35 -1, StreamDeviceInfo(), | 35 -1, StreamDeviceInfo(), |
36 constraint_factory.CreateWebMediaConstraints(), NULL, NULL)); | 36 constraint_factory.CreateWebMediaConstraints(), NULL, NULL)); |
37 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( | 37 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( |
38 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); | 38 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); |
39 scoped_ptr<WebRtcLocalAudioTrack> native_track( | 39 scoped_ptr<WebRtcLocalAudioTrack> native_track( |
40 new WebRtcLocalAudioTrack(adapter, capturer, NULL)); | 40 new WebRtcLocalAudioTrack(adapter.get(), capturer, NULL)); |
41 blink::WebMediaStreamSource audio_source; | 41 blink::WebMediaStreamSource audio_source; |
42 audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), | 42 audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), |
43 blink::WebMediaStreamSource::TypeAudio, | 43 blink::WebMediaStreamSource::TypeAudio, |
44 base::UTF8ToUTF16("dummy_source_name")); | 44 base::UTF8ToUTF16("dummy_source_name")); |
45 blink_track_.initialize(blink::WebString::fromUTF8("audio_track"), | 45 blink_track_.initialize(blink::WebString::fromUTF8("audio_track"), |
46 audio_source); | 46 audio_source); |
47 blink_track_.setExtraData(native_track.release()); | 47 blink_track_.setExtraData(native_track.release()); |
48 source_provider_.reset(new WebRtcLocalAudioSourceProvider(blink_track_)); | 48 source_provider_.reset(new WebRtcLocalAudioSourceProvider(blink_track_)); |
49 source_provider_->SetSinkParamsForTesting(sink_params_); | 49 source_provider_->SetSinkParamsForTesting(sink_params_); |
50 source_provider_->OnSetFormat(source_params_); | 50 source_provider_->OnSetFormat(source_params_); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Stop the audio track. | 129 // Stop the audio track. |
130 WebRtcLocalAudioTrack* native_track = static_cast<WebRtcLocalAudioTrack*>( | 130 WebRtcLocalAudioTrack* native_track = static_cast<WebRtcLocalAudioTrack*>( |
131 MediaStreamTrack::GetTrack(blink_track_)); | 131 MediaStreamTrack::GetTrack(blink_track_)); |
132 native_track->Stop(); | 132 native_track->Stop(); |
133 | 133 |
134 // Delete the source provider. | 134 // Delete the source provider. |
135 source_provider_.reset(); | 135 source_provider_.reset(); |
136 } | 136 } |
137 | 137 |
138 } // namespace content | 138 } // namespace content |
OLD | NEW |