| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/cast/net/cast_transport_sender_impl.h" | 5 #include "media/cast/net/cast_transport_sender_impl.h" |
| 6 | 6 |
| 7 #include <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 TEST_F(CastTransportSenderImplTest, NacksCancelRetransmits) { | 175 TEST_F(CastTransportSenderImplTest, NacksCancelRetransmits) { |
| 176 InitWithLogging(); | 176 InitWithLogging(); |
| 177 InitializeVideo(); | 177 InitializeVideo(); |
| 178 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); | 178 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 179 EXPECT_EQ(0, num_times_logging_callback_called_); | 179 EXPECT_EQ(0, num_times_logging_callback_called_); |
| 180 | 180 |
| 181 // A fake frame that will be decomposed into 4 packets. | 181 // A fake frame that will be decomposed into 4 packets. |
| 182 EncodedFrame fake_frame; | 182 EncodedFrame fake_frame; |
| 183 fake_frame.frame_id = 1; | 183 fake_frame.frame_id = 1; |
| 184 fake_frame.rtp_timestamp = 1; | 184 fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1)); |
| 185 fake_frame.dependency = EncodedFrame::KEY; | 185 fake_frame.dependency = EncodedFrame::KEY; |
| 186 fake_frame.data.resize(5000, ' '); | 186 fake_frame.data.resize(5000, ' '); |
| 187 | 187 |
| 188 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); | 188 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); |
| 189 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); | 189 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); |
| 190 EXPECT_EQ(4, transport_.packets_sent()); | 190 EXPECT_EQ(4, transport_.packets_sent()); |
| 191 EXPECT_EQ(1, num_times_logging_callback_called_); | 191 EXPECT_EQ(1, num_times_logging_callback_called_); |
| 192 | 192 |
| 193 // Resend packet 0. | 193 // Resend packet 0. |
| 194 MissingFramesAndPacketsMap missing_packets; | 194 MissingFramesAndPacketsMap missing_packets; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 223 | 223 |
| 224 TEST_F(CastTransportSenderImplTest, CancelRetransmits) { | 224 TEST_F(CastTransportSenderImplTest, CancelRetransmits) { |
| 225 InitWithLogging(); | 225 InitWithLogging(); |
| 226 InitializeVideo(); | 226 InitializeVideo(); |
| 227 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); | 227 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 228 EXPECT_EQ(0, num_times_logging_callback_called_); | 228 EXPECT_EQ(0, num_times_logging_callback_called_); |
| 229 | 229 |
| 230 // A fake frame that will be decomposed into 4 packets. | 230 // A fake frame that will be decomposed into 4 packets. |
| 231 EncodedFrame fake_frame; | 231 EncodedFrame fake_frame; |
| 232 fake_frame.frame_id = 1; | 232 fake_frame.frame_id = 1; |
| 233 fake_frame.rtp_timestamp = 1; | 233 fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1)); |
| 234 fake_frame.dependency = EncodedFrame::KEY; | 234 fake_frame.dependency = EncodedFrame::KEY; |
| 235 fake_frame.data.resize(5000, ' '); | 235 fake_frame.data.resize(5000, ' '); |
| 236 | 236 |
| 237 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); | 237 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); |
| 238 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); | 238 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); |
| 239 EXPECT_EQ(4, transport_.packets_sent()); | 239 EXPECT_EQ(4, transport_.packets_sent()); |
| 240 EXPECT_EQ(1, num_times_logging_callback_called_); | 240 EXPECT_EQ(1, num_times_logging_callback_called_); |
| 241 | 241 |
| 242 // Resend all packets for frame 1. | 242 // Resend all packets for frame 1. |
| 243 MissingFramesAndPacketsMap missing_packets; | 243 MissingFramesAndPacketsMap missing_packets; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 266 | 266 |
| 267 TEST_F(CastTransportSenderImplTest, Kickstart) { | 267 TEST_F(CastTransportSenderImplTest, Kickstart) { |
| 268 InitWithLogging(); | 268 InitWithLogging(); |
| 269 InitializeVideo(); | 269 InitializeVideo(); |
| 270 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); | 270 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 271 EXPECT_EQ(0, num_times_logging_callback_called_); | 271 EXPECT_EQ(0, num_times_logging_callback_called_); |
| 272 | 272 |
| 273 // A fake frame that will be decomposed into 4 packets. | 273 // A fake frame that will be decomposed into 4 packets. |
| 274 EncodedFrame fake_frame; | 274 EncodedFrame fake_frame; |
| 275 fake_frame.frame_id = 1; | 275 fake_frame.frame_id = 1; |
| 276 fake_frame.rtp_timestamp = 1; | 276 fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1)); |
| 277 fake_frame.dependency = EncodedFrame::KEY; | 277 fake_frame.dependency = EncodedFrame::KEY; |
| 278 fake_frame.data.resize(5000, ' '); | 278 fake_frame.data.resize(5000, ' '); |
| 279 | 279 |
| 280 transport_.SetPaused(true); | 280 transport_.SetPaused(true); |
| 281 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); | 281 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); |
| 282 transport_sender_->ResendFrameForKickstart(kVideoSsrc, 1); | 282 transport_sender_->ResendFrameForKickstart(kVideoSsrc, 1); |
| 283 transport_.SetPaused(false); | 283 transport_.SetPaused(false); |
| 284 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); | 284 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); |
| 285 EXPECT_EQ(4, transport_.packets_sent()); | 285 EXPECT_EQ(4, transport_.packets_sent()); |
| 286 EXPECT_EQ(1, num_times_logging_callback_called_); | 286 EXPECT_EQ(1, num_times_logging_callback_called_); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 task_runner_->RunTasks(); | 382 task_runner_->RunTasks(); |
| 383 EXPECT_EQ(7, transport_.packets_sent()); | 383 EXPECT_EQ(7, transport_.packets_sent()); |
| 384 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. | 384 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. |
| 385 | 385 |
| 386 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); | 386 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); |
| 387 EXPECT_EQ(2, num_times_logging_callback_called_); | 387 EXPECT_EQ(2, num_times_logging_callback_called_); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace cast | 390 } // namespace cast |
| 391 } // namespace media | 391 } // namespace media |
| OLD | NEW |