| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 // Creates a WebKit local MediaStream. | 280 // Creates a WebKit local MediaStream. |
| 281 blink::WebMediaStream CreateLocalMediaStream( | 281 blink::WebMediaStream CreateLocalMediaStream( |
| 282 const std::string& stream_label) { | 282 const std::string& stream_label) { |
| 283 std::string video_track_label("video-label"); | 283 std::string video_track_label("video-label"); |
| 284 std::string audio_track_label("audio-label"); | 284 std::string audio_track_label("audio-label"); |
| 285 blink::WebMediaStreamSource blink_audio_source; | 285 blink::WebMediaStreamSource blink_audio_source; |
| 286 blink_audio_source.initialize(blink::WebString::fromUTF8(audio_track_label), | 286 blink_audio_source.initialize(blink::WebString::fromUTF8(audio_track_label), |
| 287 blink::WebMediaStreamSource::TypeAudio, | 287 blink::WebMediaStreamSource::TypeAudio, |
| 288 blink::WebString::fromUTF8("audio_track"), | 288 blink::WebString::fromUTF8("audio_track")); |
| 289 false /* remote */); | |
| 290 ProcessedLocalAudioSource* const audio_source = | 289 ProcessedLocalAudioSource* const audio_source = |
| 291 new ProcessedLocalAudioSource( | 290 new ProcessedLocalAudioSource( |
| 292 -1 /* consumer_render_frame_id is N/A for non-browser tests */, | 291 -1 /* consumer_render_frame_id is N/A for non-browser tests */, |
| 293 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock device", | 292 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock device", |
| 294 "mock_device_id", "mock_group_id", | 293 "mock_device_id", "mock_group_id", |
| 295 media::AudioParameters::kAudioCDSampleRate, | 294 media::AudioParameters::kAudioCDSampleRate, |
| 296 media::CHANNEL_LAYOUT_STEREO, | 295 media::CHANNEL_LAYOUT_STEREO, |
| 297 media::AudioParameters::kAudioCDSampleRate / 100), | 296 media::AudioParameters::kAudioCDSampleRate / 100), |
| 298 mock_dependency_factory_.get()); | 297 mock_dependency_factory_.get()); |
| 299 audio_source->SetAllowInvalidRenderFrameIdForTesting(true); | 298 audio_source->SetAllowInvalidRenderFrameIdForTesting(true); |
| 300 audio_source->SetSourceConstraints( | 299 audio_source->SetSourceConstraints( |
| 301 MockConstraintFactory().CreateWebMediaConstraints()); | 300 MockConstraintFactory().CreateWebMediaConstraints()); |
| 302 blink_audio_source.setExtraData(audio_source); // Takes ownership. | 301 blink_audio_source.setExtraData(audio_source); // Takes ownership. |
| 303 | 302 |
| 304 blink::WebMediaStreamSource video_source; | 303 blink::WebMediaStreamSource video_source; |
| 305 video_source.initialize(blink::WebString::fromUTF8(video_track_label), | 304 video_source.initialize(blink::WebString::fromUTF8(video_track_label), |
| 306 blink::WebMediaStreamSource::TypeVideo, | 305 blink::WebMediaStreamSource::TypeVideo, |
| 307 blink::WebString::fromUTF8("video_track"), | 306 blink::WebString::fromUTF8("video_track")); |
| 308 false /* remote */); | |
| 309 MockMediaStreamVideoSource* native_video_source = | 307 MockMediaStreamVideoSource* native_video_source = |
| 310 new MockMediaStreamVideoSource(false); | 308 new MockMediaStreamVideoSource(false); |
| 311 video_source.setExtraData(native_video_source); | 309 video_source.setExtraData(native_video_source); |
| 312 | 310 |
| 313 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks( | 311 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks( |
| 314 static_cast<size_t>(1)); | 312 static_cast<size_t>(1)); |
| 315 audio_tracks[0].initialize(blink_audio_source.id(), blink_audio_source); | 313 audio_tracks[0].initialize(blink_audio_source.id(), blink_audio_source); |
| 316 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), | 314 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), |
| 317 Initialize(_, _, -1)); | 315 Initialize(_, _, -1)); |
| 318 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), | 316 EXPECT_CALL(*mock_audio_device_factory_.mock_capturer_source(), |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 testing::Ref(tracks[0]))); | 1211 testing::Ref(tracks[0]))); |
| 1214 | 1212 |
| 1215 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( | 1213 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( |
| 1216 pc_handler_->createDTMFSender(tracks[0])); | 1214 pc_handler_->createDTMFSender(tracks[0])); |
| 1217 EXPECT_TRUE(sender.get()); | 1215 EXPECT_TRUE(sender.get()); |
| 1218 | 1216 |
| 1219 StopAllTracks(local_stream); | 1217 StopAllTracks(local_stream); |
| 1220 } | 1218 } |
| 1221 | 1219 |
| 1222 } // namespace content | 1220 } // namespace content |
| OLD | NEW |