Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: talk/app/webrtc/peerconnection_unittest.cc

Issue 1640173004: Revert of Adding "first packet received" notification to PeerConnectionObserver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 std::string ice_sdp; 245 std::string ice_sdp;
246 EXPECT_TRUE(candidate->ToString(&ice_sdp)); 246 EXPECT_TRUE(candidate->ToString(&ice_sdp));
247 if (signaling_message_receiver_ == nullptr) { 247 if (signaling_message_receiver_ == nullptr) {
248 // Remote party may be deleted. 248 // Remote party may be deleted.
249 return; 249 return;
250 } 250 }
251 signaling_message_receiver_->ReceiveIceMessage( 251 signaling_message_receiver_->ReceiveIceMessage(
252 candidate->sdp_mid(), candidate->sdp_mline_index(), ice_sdp); 252 candidate->sdp_mid(), candidate->sdp_mline_index(), ice_sdp);
253 } 253 }
254 void OnFirstMediaPacketReceived() override { received_media_packet_ = true; }
255 254
256 // MediaStreamInterface callback 255 // MediaStreamInterface callback
257 void OnChanged() override { 256 void OnChanged() override {
258 // Track added or removed from MediaStream, so update our renderers. 257 // Track added or removed from MediaStream, so update our renderers.
259 rtc::scoped_refptr<StreamCollectionInterface> remote_streams = 258 rtc::scoped_refptr<StreamCollectionInterface> remote_streams =
260 pc()->remote_streams(); 259 pc()->remote_streams();
261 // Remove renderers for tracks that were removed. 260 // Remove renderers for tracks that were removed.
262 for (auto it = fake_video_renderers_.begin(); 261 for (auto it = fake_video_renderers_.begin();
263 it != fake_video_renderers_.end();) { 262 it != fake_video_renderers_.end();) {
264 if (remote_streams->FindVideoTrack(it->first) == nullptr) { 263 if (remote_streams->FindVideoTrack(it->first) == nullptr) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 bool can_receive_video() { 379 bool can_receive_video() {
381 bool value; 380 bool value;
382 if (webrtc::FindConstraint(&session_description_constraints_, 381 if (webrtc::FindConstraint(&session_description_constraints_,
383 MediaConstraintsInterface::kOfferToReceiveVideo, 382 MediaConstraintsInterface::kOfferToReceiveVideo,
384 &value, nullptr)) { 383 &value, nullptr)) {
385 return value; 384 return value;
386 } 385 }
387 return true; 386 return true;
388 } 387 }
389 388
390 bool received_media_packet() const { return received_media_packet_; }
391
392 void OnIceComplete() override { LOG(INFO) << id_ << "OnIceComplete"; } 389 void OnIceComplete() override { LOG(INFO) << id_ << "OnIceComplete"; }
393 390
394 void OnDataChannel(DataChannelInterface* data_channel) override { 391 void OnDataChannel(DataChannelInterface* data_channel) override {
395 LOG(INFO) << id_ << "OnDataChannel"; 392 LOG(INFO) << id_ << "OnDataChannel";
396 data_channel_ = data_channel; 393 data_channel_ = data_channel;
397 data_observer_.reset(new MockDataChannelObserver(data_channel)); 394 data_observer_.reset(new MockDataChannelObserver(data_channel));
398 } 395 }
399 396
400 void CreateDataChannel() { 397 void CreateDataChannel() {
401 data_channel_ = pc()->CreateDataChannel(kDataChannelLabel, nullptr); 398 data_channel_ = pc()->CreateDataChannel(kDataChannelLabel, nullptr);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 917
921 webrtc::FakeConstraints session_description_constraints_; 918 webrtc::FakeConstraints session_description_constraints_;
922 bool remove_msid_ = false; // True if MSID should be removed in received SDP. 919 bool remove_msid_ = false; // True if MSID should be removed in received SDP.
923 bool remove_bundle_ = 920 bool remove_bundle_ =
924 false; // True if bundle should be removed in received SDP. 921 false; // True if bundle should be removed in received SDP.
925 bool remove_sdes_ = 922 bool remove_sdes_ =
926 false; // True if a=crypto should be removed in received SDP. 923 false; // True if a=crypto should be removed in received SDP.
927 924
928 rtc::scoped_refptr<DataChannelInterface> data_channel_; 925 rtc::scoped_refptr<DataChannelInterface> data_channel_;
929 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; 926 rtc::scoped_ptr<MockDataChannelObserver> data_observer_;
930
931 // "true" if the PeerConnection indicated that a packet was received,
932 // through PeerConnectionObserverInterface.
933 bool received_media_packet_ = false;
934 }; 927 };
935 928
936 class P2PTestConductor : public testing::Test { 929 class P2PTestConductor : public testing::Test {
937 public: 930 public:
938 P2PTestConductor() 931 P2PTestConductor()
939 : pss_(new rtc::PhysicalSocketServer), 932 : pss_(new rtc::PhysicalSocketServer),
940 ss_(new rtc::VirtualSocketServer(pss_.get())), 933 ss_(new rtc::VirtualSocketServer(pss_.get())),
941 ss_scope_(ss_.get()) {} 934 ss_scope_(ss_.get()) {}
942 935
943 bool SessionActive() { 936 bool SessionActive() {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1097 }
1105 if (receiving_client_->can_receive_audio() || 1098 if (receiving_client_->can_receive_audio() ||
1106 receiving_client_->can_receive_video()) { 1099 receiving_client_->can_receive_video()) {
1107 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete, 1100 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete,
1108 receiving_client_->ice_gathering_state(), 1101 receiving_client_->ice_gathering_state(),
1109 kMaxWaitForFramesMs); 1102 kMaxWaitForFramesMs);
1110 } 1103 }
1111 1104
1112 EXPECT_TRUE_WAIT(FramesNotPending(audio_frame_count, video_frame_count), 1105 EXPECT_TRUE_WAIT(FramesNotPending(audio_frame_count, video_frame_count),
1113 kMaxWaitForFramesMs); 1106 kMaxWaitForFramesMs);
1114 if (audio_frame_count != -1 || video_frame_count != -1) {
1115 EXPECT_TRUE(initiating_client_->received_media_packet());
1116 EXPECT_TRUE(receiving_client_->received_media_packet());
1117 }
1118 } 1107 }
1119 1108
1120 void SetupAndVerifyDtlsCall() { 1109 void SetupAndVerifyDtlsCall() {
1121 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 1110 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1122 FakeConstraints setup_constraints; 1111 FakeConstraints setup_constraints;
1123 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1112 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1124 true); 1113 true);
1125 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); 1114 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
1126 LocalP2PTest(); 1115 LocalP2PTest();
1127 VerifyRenderedSize(640, 480); 1116 VerifyRenderedSize(640, 480);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 PeerConnectionInterface::IceServer server; 2029 PeerConnectionInterface::IceServer server;
2041 server.urls.push_back("turn:hostname"); 2030 server.urls.push_back("turn:hostname");
2042 server.urls.push_back("turn:hostname2"); 2031 server.urls.push_back("turn:hostname2");
2043 servers.push_back(server); 2032 servers.push_back(server);
2044 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2033 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2045 EXPECT_EQ(2U, turn_servers_.size()); 2034 EXPECT_EQ(2U, turn_servers_.size());
2046 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2035 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2047 } 2036 }
2048 2037
2049 #endif // if !defined(THREAD_SANITIZER) 2038 #endif // if !defined(THREAD_SANITIZER)
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698