Chromium Code Reviews| 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 // TODO(nisse): Delete test? "default channel" concept is now gone. | |
|
pthatcher1
2016/03/18 16:55:48
This test is not just verifying that we can add an
nisse-webrtc
2016/03/21 07:53:53
Done.
| |
| 1147 | |
| 1146 // Set up 2 streams where the first stream uses the default channel. | 1148 // Set up 2 streams where the first stream uses the default channel. |
| 1147 // Then disconnect the first stream and verify default channel becomes | 1149 // Then disconnect the first stream and verify default channel becomes |
| 1148 // available. | 1150 // available. |
| 1149 // Then add a new stream with |new_ssrc|. The new stream should re-use the | 1151 // Then add a new stream with |new_ssrc|. The new stream should re-use the |
| 1150 // default channel. | 1152 // default channel. |
| 1151 void TwoStreamsReUseFirstStream(const cricket::VideoCodec& codec) { | 1153 void TwoStreamsReUseFirstStream(const cricket::VideoCodec& codec) { |
| 1152 SetUpSecondStream(); | 1154 SetUpSecondStream(); |
| 1153 // Default channel used by the first stream. | |
| 1154 EXPECT_EQ(kSsrc, channel_->GetDefaultSendChannelSsrc()); | |
| 1155 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc)); | 1155 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc)); |
| 1156 EXPECT_FALSE(channel_->RemoveRecvStream(kSsrc)); | 1156 EXPECT_FALSE(channel_->RemoveRecvStream(kSsrc)); |
| 1157 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); | 1157 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); |
| 1158 EXPECT_FALSE(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; | 1159 uint32_t new_ssrc = kSsrc + 100; |
| 1162 EXPECT_TRUE(channel_->AddSendStream( | 1160 EXPECT_TRUE(channel_->AddSendStream( |
| 1163 cricket::StreamParams::CreateLegacy(new_ssrc))); | 1161 cricket::StreamParams::CreateLegacy(new_ssrc))); |
| 1164 // Re-use default channel. | |
| 1165 EXPECT_EQ(new_ssrc, channel_->GetDefaultSendChannelSsrc()); | |
| 1166 EXPECT_FALSE(channel_->AddSendStream( | 1162 EXPECT_FALSE(channel_->AddSendStream( |
| 1167 cricket::StreamParams::CreateLegacy(new_ssrc))); | 1163 cricket::StreamParams::CreateLegacy(new_ssrc))); |
| 1168 EXPECT_TRUE(channel_->AddRecvStream( | 1164 EXPECT_TRUE(channel_->AddRecvStream( |
| 1169 cricket::StreamParams::CreateLegacy(new_ssrc))); | 1165 cricket::StreamParams::CreateLegacy(new_ssrc))); |
| 1170 EXPECT_TRUE(channel_->SetSink(new_ssrc, &renderer_)); | 1166 EXPECT_TRUE(channel_->SetSink(new_ssrc, &renderer_)); |
| 1171 EXPECT_FALSE(channel_->AddRecvStream( | 1167 EXPECT_FALSE(channel_->AddRecvStream( |
| 1172 cricket::StreamParams::CreateLegacy(new_ssrc))); | 1168 cricket::StreamParams::CreateLegacy(new_ssrc))); |
| 1173 | 1169 |
| 1174 EXPECT_TRUE(channel_->SetCapturer(new_ssrc, video_capturer_.get())); | 1170 EXPECT_TRUE(channel_->SetCapturer(new_ssrc, video_capturer_.get())); |
| 1175 | 1171 |
| 1176 SendAndReceive(codec); | 1172 SendAndReceive(codec); |
| 1177 EXPECT_TRUE(channel_->RemoveSendStream(new_ssrc)); | 1173 EXPECT_TRUE(channel_->RemoveSendStream(new_ssrc)); |
| 1178 EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc()); | |
| 1179 } | 1174 } |
| 1180 | 1175 |
| 1181 const std::unique_ptr<webrtc::Call> call_; | 1176 const std::unique_ptr<webrtc::Call> call_; |
| 1182 VideoEngineOverride<E> engine_; | 1177 VideoEngineOverride<E> engine_; |
| 1183 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_; | 1178 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_; |
| 1184 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_2_; | 1179 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_2_; |
| 1185 std::unique_ptr<C> channel_; | 1180 std::unique_ptr<C> channel_; |
| 1186 cricket::FakeNetworkInterface network_interface_; | 1181 cricket::FakeNetworkInterface network_interface_; |
| 1187 cricket::FakeVideoRenderer renderer_; | 1182 cricket::FakeVideoRenderer renderer_; |
| 1188 cricket::VideoMediaChannel::Error media_error_; | 1183 cricket::VideoMediaChannel::Error media_error_; |
| 1189 | 1184 |
| 1190 // Used by test cases where 2 streams are run on the same channel. | 1185 // Used by test cases where 2 streams are run on the same channel. |
| 1191 cricket::FakeVideoRenderer renderer2_; | 1186 cricket::FakeVideoRenderer renderer2_; |
| 1192 }; | 1187 }; |
| 1193 | 1188 |
| 1194 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 1189 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
| OLD | NEW |