| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  *  Copyright 2013 The WebRTC project authors. All Rights Reserved. |    2  *  Copyright 2013 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  | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   57  |   57  | 
|   58 PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {} |   58 PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {} | 
|   59  |   59  | 
|   60 bool PeerConnectionTestWrapper::CreatePc( |   60 bool PeerConnectionTestWrapper::CreatePc( | 
|   61     const MediaConstraintsInterface* constraints, |   61     const MediaConstraintsInterface* constraints, | 
|   62     const webrtc::PeerConnectionInterface::RTCConfiguration& config) { |   62     const webrtc::PeerConnectionInterface::RTCConfiguration& config) { | 
|   63   std::unique_ptr<cricket::PortAllocator> port_allocator( |   63   std::unique_ptr<cricket::PortAllocator> port_allocator( | 
|   64       new cricket::FakePortAllocator(network_thread_, nullptr)); |   64       new cricket::FakePortAllocator(network_thread_, nullptr)); | 
|   65  |   65  | 
|   66   fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); |   66   fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); | 
|   67   if (fake_audio_capture_module_ == NULL) { |   67   if (fake_audio_capture_module_ == nullptr) { | 
|   68     return false; |   68     return false; | 
|   69   } |   69   } | 
|   70  |   70  | 
|   71   peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( |   71   peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( | 
|   72       network_thread_, worker_thread_, rtc::Thread::Current(), |   72       network_thread_, worker_thread_, rtc::Thread::Current(), | 
|   73       fake_audio_capture_module_, NULL, NULL); |   73       fake_audio_capture_module_, nullptr, nullptr); | 
|   74   if (!peer_connection_factory_) { |   74   if (!peer_connection_factory_) { | 
|   75     return false; |   75     return false; | 
|   76   } |   76   } | 
|   77  |   77  | 
|   78   std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator( |   78   std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator( | 
|   79       new FakeRTCCertificateGenerator()); |   79       new FakeRTCCertificateGenerator()); | 
|   80   peer_connection_ = peer_connection_factory_->CreatePeerConnection( |   80   peer_connection_ = peer_connection_factory_->CreatePeerConnection( | 
|   81       config, constraints, std::move(port_allocator), std::move(cert_generator), |   81       config, constraints, std::move(port_allocator), std::move(cert_generator), | 
|   82       this); |   82       this); | 
|   83  |   83  | 
|   84   return peer_connection_.get() != NULL; |   84   return peer_connection_.get() != nullptr; | 
|   85 } |   85 } | 
|   86  |   86  | 
|   87 rtc::scoped_refptr<webrtc::DataChannelInterface> |   87 rtc::scoped_refptr<webrtc::DataChannelInterface> | 
|   88 PeerConnectionTestWrapper::CreateDataChannel( |   88 PeerConnectionTestWrapper::CreateDataChannel( | 
|   89     const std::string& label, |   89     const std::string& label, | 
|   90     const webrtc::DataChannelInit& init) { |   90     const webrtc::DataChannelInit& init) { | 
|   91   return peer_connection_->CreateDataChannel(label, &init); |   91   return peer_connection_->CreateDataChannel(label, &init); | 
|   92 } |   92 } | 
|   93  |   93  | 
|   94 void PeerConnectionTestWrapper::OnAddStream( |   94 void PeerConnectionTestWrapper::OnAddStream( | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  142  |  142  | 
|  143 void PeerConnectionTestWrapper::CreateAnswer( |  143 void PeerConnectionTestWrapper::CreateAnswer( | 
|  144     const MediaConstraintsInterface* constraints) { |  144     const MediaConstraintsInterface* constraints) { | 
|  145   LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ |  145   LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ | 
|  146                << ": CreateAnswer."; |  146                << ": CreateAnswer."; | 
|  147   peer_connection_->CreateAnswer(this, constraints); |  147   peer_connection_->CreateAnswer(this, constraints); | 
|  148 } |  148 } | 
|  149  |  149  | 
|  150 void PeerConnectionTestWrapper::ReceiveOfferSdp(const std::string& sdp) { |  150 void PeerConnectionTestWrapper::ReceiveOfferSdp(const std::string& sdp) { | 
|  151   SetRemoteDescription(SessionDescriptionInterface::kOffer, sdp); |  151   SetRemoteDescription(SessionDescriptionInterface::kOffer, sdp); | 
|  152   CreateAnswer(NULL); |  152   CreateAnswer(nullptr); | 
|  153 } |  153 } | 
|  154  |  154  | 
|  155 void PeerConnectionTestWrapper::ReceiveAnswerSdp(const std::string& sdp) { |  155 void PeerConnectionTestWrapper::ReceiveAnswerSdp(const std::string& sdp) { | 
|  156   SetRemoteDescription(SessionDescriptionInterface::kAnswer, sdp); |  156   SetRemoteDescription(SessionDescriptionInterface::kAnswer, sdp); | 
|  157 } |  157 } | 
|  158  |  158  | 
|  159 void PeerConnectionTestWrapper::SetLocalDescription(const std::string& type, |  159 void PeerConnectionTestWrapper::SetLocalDescription(const std::string& type, | 
|  160                                                     const std::string& sdp) { |  160                                                     const std::string& sdp) { | 
|  161   LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ |  161   LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ | 
|  162                << ": SetLocalDescription " << type << " " << sdp; |  162                << ": SetLocalDescription " << type << " " << sdp; | 
|  163  |  163  | 
|  164   rtc::scoped_refptr<MockSetSessionDescriptionObserver> |  164   rtc::scoped_refptr<MockSetSessionDescriptionObserver> | 
|  165       observer(new rtc::RefCountedObject< |  165       observer(new rtc::RefCountedObject< | 
|  166                    MockSetSessionDescriptionObserver>()); |  166                    MockSetSessionDescriptionObserver>()); | 
|  167   peer_connection_->SetLocalDescription( |  167   peer_connection_->SetLocalDescription( | 
|  168       observer, webrtc::CreateSessionDescription(type, sdp, NULL)); |  168       observer, webrtc::CreateSessionDescription(type, sdp, nullptr)); | 
|  169 } |  169 } | 
|  170  |  170  | 
|  171 void PeerConnectionTestWrapper::SetRemoteDescription(const std::string& type, |  171 void PeerConnectionTestWrapper::SetRemoteDescription(const std::string& type, | 
|  172                                                      const std::string& sdp) { |  172                                                      const std::string& sdp) { | 
|  173   LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ |  173   LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ | 
|  174                << ": SetRemoteDescription " << type << " " << sdp; |  174                << ": SetRemoteDescription " << type << " " << sdp; | 
|  175  |  175  | 
|  176   rtc::scoped_refptr<MockSetSessionDescriptionObserver> |  176   rtc::scoped_refptr<MockSetSessionDescriptionObserver> | 
|  177       observer(new rtc::RefCountedObject< |  177       observer(new rtc::RefCountedObject< | 
|  178                    MockSetSessionDescriptionObserver>()); |  178                    MockSetSessionDescriptionObserver>()); | 
|  179   peer_connection_->SetRemoteDescription( |  179   peer_connection_->SetRemoteDescription( | 
|  180       observer, webrtc::CreateSessionDescription(type, sdp, NULL)); |  180       observer, webrtc::CreateSessionDescription(type, sdp, nullptr)); | 
|  181 } |  181 } | 
|  182  |  182  | 
|  183 void PeerConnectionTestWrapper::AddIceCandidate(const std::string& sdp_mid, |  183 void PeerConnectionTestWrapper::AddIceCandidate(const std::string& sdp_mid, | 
|  184                                                 int sdp_mline_index, |  184                                                 int sdp_mline_index, | 
|  185                                                 const std::string& candidate) { |  185                                                 const std::string& candidate) { | 
|  186   std::unique_ptr<webrtc::IceCandidateInterface> owned_candidate( |  186   std::unique_ptr<webrtc::IceCandidateInterface> owned_candidate( | 
|  187       webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, candidate, NULL)); |  187       webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, candidate, nullptr)); | 
|  188   EXPECT_TRUE(peer_connection_->AddIceCandidate(owned_candidate.get())); |  188   EXPECT_TRUE(peer_connection_->AddIceCandidate(owned_candidate.get())); | 
|  189 } |  189 } | 
|  190  |  190  | 
|  191 void PeerConnectionTestWrapper::WaitForCallEstablished() { |  191 void PeerConnectionTestWrapper::WaitForCallEstablished() { | 
|  192   WaitForConnection(); |  192   WaitForConnection(); | 
|  193   WaitForAudio(); |  193   WaitForAudio(); | 
|  194   WaitForVideo(); |  194   WaitForVideo(); | 
|  195 } |  195 } | 
|  196  |  196  | 
|  197 void PeerConnectionTestWrapper::WaitForConnection() { |  197 void PeerConnectionTestWrapper::WaitForConnection() { | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  271         peer_connection_factory_->CreateVideoSource( |  271         peer_connection_factory_->CreateVideoSource( | 
|  272             new webrtc::FakePeriodicVideoCapturer(), &constraints); |  272             new webrtc::FakePeriodicVideoCapturer(), &constraints); | 
|  273     std::string videotrack_label = label + kVideoTrackLabelBase; |  273     std::string videotrack_label = label + kVideoTrackLabelBase; | 
|  274     rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track( |  274     rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track( | 
|  275         peer_connection_factory_->CreateVideoTrack(videotrack_label, source)); |  275         peer_connection_factory_->CreateVideoTrack(videotrack_label, source)); | 
|  276  |  276  | 
|  277     stream->AddTrack(video_track); |  277     stream->AddTrack(video_track); | 
|  278   } |  278   } | 
|  279   return stream; |  279   return stream; | 
|  280 } |  280 } | 
| OLD | NEW |