| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) { | 1136 void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) { |
| 1137 SetUpSecondStream(); | 1137 SetUpSecondStream(); |
| 1138 // Test sending and receiving on first stream. | 1138 // Test sending and receiving on first stream. |
| 1139 SendAndReceive(codec); | 1139 SendAndReceive(codec); |
| 1140 // Test sending and receiving on second stream. | 1140 // Test sending and receiving on second stream. |
| 1141 EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout); | 1141 EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout); |
| 1142 EXPECT_GT(NumRtpPackets(), 0); | 1142 EXPECT_GT(NumRtpPackets(), 0); |
| 1143 EXPECT_EQ(1, renderer2_.num_rendered_frames()); | 1143 EXPECT_EQ(1, renderer2_.num_rendered_frames()); |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 // Set up 2 streams where the first stream uses the default channel. | |
| 1147 // Then disconnect the first stream and verify default channel becomes | |
| 1148 // available. | |
| 1149 // Then add a new stream with |new_ssrc|. The new stream should re-use the | |
| 1150 // default channel. | |
| 1151 void TwoStreamsReUseFirstStream(const cricket::VideoCodec& codec) { | |
| 1152 SetUpSecondStream(); | |
| 1153 // Default channel used by the first stream. | |
| 1154 EXPECT_EQ(kSsrc, channel_->GetDefaultSendChannelSsrc()); | |
| 1155 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc)); | |
| 1156 EXPECT_FALSE(channel_->RemoveRecvStream(kSsrc)); | |
| 1157 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); | |
| 1158 EXPECT_FALSE(channel_->RemoveSendStream(kSsrc)); | |
| 1159 // Default channel is no longer used by a stream. | |
| 1160 EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc()); | |
| 1161 uint32_t new_ssrc = kSsrc + 100; | |
| 1162 EXPECT_TRUE(channel_->AddSendStream( | |
| 1163 cricket::StreamParams::CreateLegacy(new_ssrc))); | |
| 1164 // Re-use default channel. | |
| 1165 EXPECT_EQ(new_ssrc, channel_->GetDefaultSendChannelSsrc()); | |
| 1166 EXPECT_FALSE(channel_->AddSendStream( | |
| 1167 cricket::StreamParams::CreateLegacy(new_ssrc))); | |
| 1168 EXPECT_TRUE(channel_->AddRecvStream( | |
| 1169 cricket::StreamParams::CreateLegacy(new_ssrc))); | |
| 1170 EXPECT_TRUE(channel_->SetSink(new_ssrc, &renderer_)); | |
| 1171 EXPECT_FALSE(channel_->AddRecvStream( | |
| 1172 cricket::StreamParams::CreateLegacy(new_ssrc))); | |
| 1173 | |
| 1174 EXPECT_TRUE(channel_->SetCapturer(new_ssrc, video_capturer_.get())); | |
| 1175 | |
| 1176 SendAndReceive(codec); | |
| 1177 EXPECT_TRUE(channel_->RemoveSendStream(new_ssrc)); | |
| 1178 EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc()); | |
| 1179 } | |
| 1180 | |
| 1181 const std::unique_ptr<webrtc::Call> call_; | 1146 const std::unique_ptr<webrtc::Call> call_; |
| 1182 VideoEngineOverride<E> engine_; | 1147 VideoEngineOverride<E> engine_; |
| 1183 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_; | 1148 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_; |
| 1184 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_2_; | 1149 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_2_; |
| 1185 std::unique_ptr<C> channel_; | 1150 std::unique_ptr<C> channel_; |
| 1186 cricket::FakeNetworkInterface network_interface_; | 1151 cricket::FakeNetworkInterface network_interface_; |
| 1187 cricket::FakeVideoRenderer renderer_; | 1152 cricket::FakeVideoRenderer renderer_; |
| 1188 cricket::VideoMediaChannel::Error media_error_; | 1153 cricket::VideoMediaChannel::Error media_error_; |
| 1189 | 1154 |
| 1190 // Used by test cases where 2 streams are run on the same channel. | 1155 // Used by test cases where 2 streams are run on the same channel. |
| 1191 cricket::FakeVideoRenderer renderer2_; | 1156 cricket::FakeVideoRenderer renderer2_; |
| 1192 }; | 1157 }; |
| 1193 | 1158 |
| 1194 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 1159 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
| OLD | NEW |