| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "webrtc/api/audiotrack.h" | 14 #include "webrtc/api/audiotrack.h" |
| 15 #include "webrtc/api/jsepsessiondescription.h" | 15 #include "webrtc/api/jsepsessiondescription.h" |
| 16 #include "webrtc/api/mediastream.h" | 16 #include "webrtc/api/mediastream.h" |
| 17 #include "webrtc/api/mediastreaminterface.h" | 17 #include "webrtc/api/mediastreaminterface.h" |
| 18 #include "webrtc/api/peerconnection.h" | 18 #include "webrtc/api/peerconnection.h" |
| 19 #include "webrtc/api/peerconnectioninterface.h" | 19 #include "webrtc/api/peerconnectioninterface.h" |
| 20 #include "webrtc/api/rtpreceiverinterface.h" | 20 #include "webrtc/api/rtpreceiverinterface.h" |
| 21 #include "webrtc/api/rtpsenderinterface.h" | 21 #include "webrtc/api/rtpsenderinterface.h" |
| 22 #include "webrtc/api/streamcollection.h" | 22 #include "webrtc/api/streamcollection.h" |
| 23 #ifdef WEBRTC_ANDROID | 23 #ifdef WEBRTC_ANDROID |
| 24 #include "webrtc/api/test/androidtestinitializer.h" | 24 #include "webrtc/api/test/androidtestinitializer.h" |
| 25 #endif | 25 #endif |
| 26 #include "webrtc/api/test/fakeconstraints.h" | 26 #include "webrtc/api/test/fakeconstraints.h" |
| 27 #include "webrtc/api/test/fakedtlsidentitystore.h" | 27 #include "webrtc/api/test/fakedtlsidentitystore.h" |
| 28 #include "webrtc/api/test/mockpeerconnectionobservers.h" | 28 #include "webrtc/api/test/mockpeerconnectionobservers.h" |
| 29 #include "webrtc/api/test/testsdpstrings.h" | 29 #include "webrtc/api/test/testsdpstrings.h" |
| 30 #include "webrtc/api/videosource.h" | 30 #include "webrtc/api/videocapturertracksource.h" |
| 31 #include "webrtc/api/videotrack.h" | 31 #include "webrtc/api/videotrack.h" |
| 32 #include "webrtc/base/gunit.h" | 32 #include "webrtc/base/gunit.h" |
| 33 #include "webrtc/base/scoped_ptr.h" | 33 #include "webrtc/base/scoped_ptr.h" |
| 34 #include "webrtc/base/ssladapter.h" | 34 #include "webrtc/base/ssladapter.h" |
| 35 #include "webrtc/base/sslstreamadapter.h" | 35 #include "webrtc/base/sslstreamadapter.h" |
| 36 #include "webrtc/base/stringutils.h" | 36 #include "webrtc/base/stringutils.h" |
| 37 #include "webrtc/base/thread.h" | 37 #include "webrtc/base/thread.h" |
| 38 #include "webrtc/media/base/fakevideocapturer.h" | 38 #include "webrtc/media/base/fakevideocapturer.h" |
| 39 #include "webrtc/media/sctp/sctpdataengine.h" | 39 #include "webrtc/media/sctp/sctpdataengine.h" |
| 40 #include "webrtc/p2p/client/fakeportallocator.h" | 40 #include "webrtc/p2p/client/fakeportallocator.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 using webrtc::MockSetSessionDescriptionObserver; | 255 using webrtc::MockSetSessionDescriptionObserver; |
| 256 using webrtc::MockStatsObserver; | 256 using webrtc::MockStatsObserver; |
| 257 using webrtc::PeerConnectionInterface; | 257 using webrtc::PeerConnectionInterface; |
| 258 using webrtc::PeerConnectionObserver; | 258 using webrtc::PeerConnectionObserver; |
| 259 using webrtc::RtpReceiverInterface; | 259 using webrtc::RtpReceiverInterface; |
| 260 using webrtc::RtpSenderInterface; | 260 using webrtc::RtpSenderInterface; |
| 261 using webrtc::SdpParseError; | 261 using webrtc::SdpParseError; |
| 262 using webrtc::SessionDescriptionInterface; | 262 using webrtc::SessionDescriptionInterface; |
| 263 using webrtc::StreamCollection; | 263 using webrtc::StreamCollection; |
| 264 using webrtc::StreamCollectionInterface; | 264 using webrtc::StreamCollectionInterface; |
| 265 using webrtc::VideoSourceInterface; | 265 using webrtc::VideoTrackSourceInterface; |
| 266 using webrtc::VideoTrack; | 266 using webrtc::VideoTrack; |
| 267 using webrtc::VideoTrackInterface; | 267 using webrtc::VideoTrackInterface; |
| 268 | 268 |
| 269 typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions; | 269 typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions; |
| 270 | 270 |
| 271 namespace { | 271 namespace { |
| 272 | 272 |
| 273 // Gets the first ssrc of given content type from the ContentInfo. | 273 // Gets the first ssrc of given content type from the ContentInfo. |
| 274 bool GetFirstSsrc(const cricket::ContentInfo* content_info, int* ssrc) { | 274 bool GetFirstSsrc(const cricket::ContentInfo* content_info, int* ssrc) { |
| 275 if (!content_info || !ssrc) { | 275 if (!content_info || !ssrc) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 590 |
| 591 void ReleasePeerConnection() { | 591 void ReleasePeerConnection() { |
| 592 pc_ = NULL; | 592 pc_ = NULL; |
| 593 observer_.SetPeerConnectionInterface(NULL); | 593 observer_.SetPeerConnectionInterface(NULL); |
| 594 } | 594 } |
| 595 | 595 |
| 596 void AddVideoStream(const std::string& label) { | 596 void AddVideoStream(const std::string& label) { |
| 597 // Create a local stream. | 597 // Create a local stream. |
| 598 scoped_refptr<MediaStreamInterface> stream( | 598 scoped_refptr<MediaStreamInterface> stream( |
| 599 pc_factory_->CreateLocalMediaStream(label)); | 599 pc_factory_->CreateLocalMediaStream(label)); |
| 600 scoped_refptr<VideoSourceInterface> video_source( | 600 scoped_refptr<VideoTrackSourceInterface> video_source( |
| 601 pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer(), NULL)); | 601 pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer(), NULL)); |
| 602 scoped_refptr<VideoTrackInterface> video_track( | 602 scoped_refptr<VideoTrackInterface> video_track( |
| 603 pc_factory_->CreateVideoTrack(label + "v0", video_source)); | 603 pc_factory_->CreateVideoTrack(label + "v0", video_source)); |
| 604 stream->AddTrack(video_track.get()); | 604 stream->AddTrack(video_track.get()); |
| 605 EXPECT_TRUE(pc_->AddStream(stream)); | 605 EXPECT_TRUE(pc_->AddStream(stream)); |
| 606 EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout); | 606 EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout); |
| 607 observer_.renegotiation_needed_ = false; | 607 observer_.renegotiation_needed_ = false; |
| 608 } | 608 } |
| 609 | 609 |
| 610 void AddVoiceStream(const std::string& label) { | 610 void AddVoiceStream(const std::string& label) { |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 FakeConstraints updated_answer_c; | 2606 FakeConstraints updated_answer_c; |
| 2607 answer_c.SetMandatoryReceiveAudio(false); | 2607 answer_c.SetMandatoryReceiveAudio(false); |
| 2608 answer_c.SetMandatoryReceiveVideo(false); | 2608 answer_c.SetMandatoryReceiveVideo(false); |
| 2609 | 2609 |
| 2610 cricket::MediaSessionOptions updated_answer_options; | 2610 cricket::MediaSessionOptions updated_answer_options; |
| 2611 EXPECT_TRUE( | 2611 EXPECT_TRUE( |
| 2612 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2612 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
| 2613 EXPECT_TRUE(updated_answer_options.has_audio()); | 2613 EXPECT_TRUE(updated_answer_options.has_audio()); |
| 2614 EXPECT_TRUE(updated_answer_options.has_video()); | 2614 EXPECT_TRUE(updated_answer_options.has_video()); |
| 2615 } | 2615 } |
| OLD | NEW |