| 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 */); | |
| 297 ProcessedLocalAudioSource* const audio_source = | 296 ProcessedLocalAudioSource* const audio_source = |
| 298 new ProcessedLocalAudioSource( | 297 new ProcessedLocalAudioSource( |
| 299 -1 /* consumer_render_frame_id is N/A for non-browser tests */, | 298 -1 /* consumer_render_frame_id is N/A for non-browser tests */, |
| 300 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock device", | 299 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock device", |
| 301 "mock_device_id", | 300 "mock_device_id", |
| 302 media::AudioParameters::kAudioCDSampleRate, | 301 media::AudioParameters::kAudioCDSampleRate, |
| 303 media::CHANNEL_LAYOUT_STEREO, | 302 media::CHANNEL_LAYOUT_STEREO, |
| 304 media::AudioParameters::kAudioCDSampleRate / 100), | 303 media::AudioParameters::kAudioCDSampleRate / 100), |
| 305 MockConstraintFactory().CreateWebMediaConstraints(), | 304 MockConstraintFactory().CreateWebMediaConstraints(), |
| 306 base::Bind(&RTCPeerConnectionHandlerTest::OnAudioSourceStarted), | 305 base::Bind(&RTCPeerConnectionHandlerTest::OnAudioSourceStarted), |
| 307 mock_dependency_factory_.get()); | 306 mock_dependency_factory_.get()); |
| 308 audio_source->SetAllowInvalidRenderFrameIdForTesting(true); | 307 audio_source->SetAllowInvalidRenderFrameIdForTesting(true); |
| 309 blink_audio_source.setExtraData(audio_source); // Takes ownership. | 308 blink_audio_source.setExtraData(audio_source); // Takes ownership. |
| 310 | 309 |
| 311 blink::WebMediaStreamSource video_source; | 310 blink::WebMediaStreamSource video_source; |
| 312 video_source.initialize(blink::WebString::fromUTF8(video_track_label), | 311 video_source.initialize(blink::WebString::fromUTF8(video_track_label), |
| 313 blink::WebMediaStreamSource::TypeVideo, | 312 blink::WebMediaStreamSource::TypeVideo, |
| 314 blink::WebString::fromUTF8("video_track"), | 313 blink::WebString::fromUTF8("video_track")); |
| 315 false /* remote */); | |
| 316 MockMediaStreamVideoSource* native_video_source = | 314 MockMediaStreamVideoSource* native_video_source = |
| 317 new MockMediaStreamVideoSource(false); | 315 new MockMediaStreamVideoSource(false); |
| 318 video_source.setExtraData(native_video_source); | 316 video_source.setExtraData(native_video_source); |
| 319 | 317 |
| 320 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks( | 318 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks( |
| 321 static_cast<size_t>(1)); | 319 static_cast<size_t>(1)); |
| 322 audio_tracks[0].initialize(blink_audio_source.id(), blink_audio_source); | 320 audio_tracks[0].initialize(blink_audio_source.id(), blink_audio_source); |
| 323 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), | 321 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), |
| 324 Initialize(_, _, -1)); | 322 Initialize(_, _, -1)); |
| 325 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), | 323 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 testing::Ref(tracks[0]))); | 1306 testing::Ref(tracks[0]))); |
| 1309 | 1307 |
| 1310 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( | 1308 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( |
| 1311 pc_handler_->createDTMFSender(tracks[0])); | 1309 pc_handler_->createDTMFSender(tracks[0])); |
| 1312 EXPECT_TRUE(sender.get()); | 1310 EXPECT_TRUE(sender.get()); |
| 1313 | 1311 |
| 1314 StopAllTracks(local_stream); | 1312 StopAllTracks(local_stream); |
| 1315 } | 1313 } |
| 1316 | 1314 |
| 1317 } // namespace content | 1315 } // namespace content |
| OLD | NEW |