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/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 285 } |
286 | 286 |
287 // Creates a WebKit local MediaStream. | 287 // Creates a WebKit local MediaStream. |
288 blink::WebMediaStream CreateLocalMediaStream( | 288 blink::WebMediaStream CreateLocalMediaStream( |
289 const std::string& stream_label) { | 289 const std::string& stream_label) { |
290 std::string video_track_label("video-label"); | 290 std::string video_track_label("video-label"); |
291 std::string audio_track_label("audio-label"); | 291 std::string audio_track_label("audio-label"); |
292 blink::WebMediaStreamSource blink_audio_source; | 292 blink::WebMediaStreamSource blink_audio_source; |
293 blink_audio_source.initialize(blink::WebString::fromUTF8(audio_track_label), | 293 blink_audio_source.initialize(blink::WebString::fromUTF8(audio_track_label), |
294 blink::WebMediaStreamSource::TypeAudio, | 294 blink::WebMediaStreamSource::TypeAudio, |
295 blink::WebString::fromUTF8("audio_track")); | 295 blink::WebString::fromUTF8("audio_track"), |
| 296 false /* remote */); |
296 ProcessedLocalAudioSource* const audio_source = | 297 ProcessedLocalAudioSource* const audio_source = |
297 new ProcessedLocalAudioSource( | 298 new ProcessedLocalAudioSource( |
298 -1 /* consumer_render_frame_id is N/A for non-browser tests */, | 299 -1 /* consumer_render_frame_id is N/A for non-browser tests */, |
299 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock device", | 300 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock device", |
300 "mock_device_id", | 301 "mock_device_id", |
301 media::AudioParameters::kAudioCDSampleRate, | 302 media::AudioParameters::kAudioCDSampleRate, |
302 media::CHANNEL_LAYOUT_STEREO, | 303 media::CHANNEL_LAYOUT_STEREO, |
303 media::AudioParameters::kAudioCDSampleRate / 100), | 304 media::AudioParameters::kAudioCDSampleRate / 100), |
304 MockConstraintFactory().CreateWebMediaConstraints(), | 305 MockConstraintFactory().CreateWebMediaConstraints(), |
305 base::Bind(&RTCPeerConnectionHandlerTest::OnAudioSourceStarted), | 306 base::Bind(&RTCPeerConnectionHandlerTest::OnAudioSourceStarted), |
306 mock_dependency_factory_.get()); | 307 mock_dependency_factory_.get()); |
307 audio_source->SetAllowInvalidRenderFrameIdForTesting(true); | 308 audio_source->SetAllowInvalidRenderFrameIdForTesting(true); |
308 blink_audio_source.setExtraData(audio_source); // Takes ownership. | 309 blink_audio_source.setExtraData(audio_source); // Takes ownership. |
309 | 310 |
310 blink::WebMediaStreamSource video_source; | 311 blink::WebMediaStreamSource video_source; |
311 video_source.initialize(blink::WebString::fromUTF8(video_track_label), | 312 video_source.initialize(blink::WebString::fromUTF8(video_track_label), |
312 blink::WebMediaStreamSource::TypeVideo, | 313 blink::WebMediaStreamSource::TypeVideo, |
313 blink::WebString::fromUTF8("video_track")); | 314 blink::WebString::fromUTF8("video_track"), |
| 315 false /* remote */); |
314 MockMediaStreamVideoSource* native_video_source = | 316 MockMediaStreamVideoSource* native_video_source = |
315 new MockMediaStreamVideoSource(false); | 317 new MockMediaStreamVideoSource(false); |
316 video_source.setExtraData(native_video_source); | 318 video_source.setExtraData(native_video_source); |
317 | 319 |
318 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks( | 320 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks( |
319 static_cast<size_t>(1)); | 321 static_cast<size_t>(1)); |
320 audio_tracks[0].initialize(blink_audio_source.id(), blink_audio_source); | 322 audio_tracks[0].initialize(blink_audio_source.id(), blink_audio_source); |
321 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), | 323 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), |
322 Initialize(_, _, -1)); | 324 Initialize(_, _, -1)); |
323 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), | 325 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 testing::Ref(tracks[0]))); | 1308 testing::Ref(tracks[0]))); |
1307 | 1309 |
1308 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( | 1310 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( |
1309 pc_handler_->createDTMFSender(tracks[0])); | 1311 pc_handler_->createDTMFSender(tracks[0])); |
1310 EXPECT_TRUE(sender.get()); | 1312 EXPECT_TRUE(sender.get()); |
1311 | 1313 |
1312 StopAllTracks(local_stream); | 1314 StopAllTracks(local_stream); |
1313 } | 1315 } |
1314 | 1316 |
1315 } // namespace content | 1317 } // namespace content |
OLD | NEW |