| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This test generate synthetic data. For audio it's a sinusoid waveform with | 5 // This test generate synthetic data. For audio it's a sinusoid waveform with |
| 6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern | 6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern |
| 7 // that is shifting by one pixel per frame, each pixels neighbors right and down | 7 // that is shifting by one pixel per frame, each pixels neighbors right and down |
| 8 // is this pixels value +1, since the pixel value is 8 bit it will wrap | 8 // is this pixels value +1, since the pixel value is 8 bit it will wrap |
| 9 // frequently within the image. Visually this will create diagonally color bands | 9 // frequently within the image. Visually this will create diagonally color bands |
| 10 // that moves across the screen | 10 // that moves across the screen |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 static const int kVideoQcifWidth = 176; | 55 static const int kVideoQcifWidth = 176; |
| 56 static const int kVideoQcifHeight = 144; | 56 static const int kVideoQcifHeight = 144; |
| 57 | 57 |
| 58 // Since the video encoded and decoded an error will be introduced; when | 58 // Since the video encoded and decoded an error will be introduced; when |
| 59 // comparing individual pixels the error can be quite large; we allow a PSNR of | 59 // comparing individual pixels the error can be quite large; we allow a PSNR of |
| 60 // at least |kVideoAcceptedPSNR|. | 60 // at least |kVideoAcceptedPSNR|. |
| 61 static const double kVideoAcceptedPSNR = 38.0; | 61 static const double kVideoAcceptedPSNR = 38.0; |
| 62 | 62 |
| 63 // The tests are commonly implemented with |kFrameTimerMs| RunTask function; | 63 // The tests are commonly implemented with |kFrameTimerMs| RunTask function; |
| 64 // a normal video is 30 fps hence the 33 ms between frames. | 64 // a normal video is 30 fps hence the 33 ms between frames. |
| 65 // |
| 66 // TODO(miu): The errors in timing will add up significantly. Find an |
| 67 // alternative approaches that eliminate use of this constant. |
| 65 static const int kFrameTimerMs = 33; | 68 static const int kFrameTimerMs = 33; |
| 66 | 69 |
| 67 // The packets pass through the pacer which can delay the beginning of the | |
| 68 // frame by 10 ms if there is packets belonging to the previous frame being | |
| 69 // retransmitted. | |
| 70 // In addition, audio packets are sent in 10mS intervals in audio_encoder.cc, | |
| 71 // although we send an audio frame every 33mS, which adds an extra delay. | |
| 72 // A TODO was added in the code to resolve this. | |
| 73 static const int kTimerErrorMs = 20; | |
| 74 | |
| 75 // Start the video synthetic start value to medium range value, to avoid edge | 70 // Start the video synthetic start value to medium range value, to avoid edge |
| 76 // effects cause by encoding and quantization. | 71 // effects cause by encoding and quantization. |
| 77 static const int kVideoStart = 100; | 72 static const int kVideoStart = 100; |
| 78 | 73 |
| 79 // The size of audio frames. The encoder joins/breaks all inserted audio into | 74 // The size of audio frames. The encoder joins/breaks all inserted audio into |
| 80 // chunks of this size. | 75 // chunks of this size. |
| 81 static const int kAudioFrameDurationMs = 10; | 76 static const int kAudioFrameDurationMs = 10; |
| 82 | 77 |
| 78 // The amount of time between frame capture on the sender and playout on the |
| 79 // receiver. |
| 80 static const int kTargetPlayoutDelayMs = 100; |
| 81 |
| 82 // The maximum amount of deviation expected in the playout times emitted by the |
| 83 // receiver. |
| 84 // |
| 85 // TODO(miu): This is a "fuzzy" way to check the timestamps. We should be able |
| 86 // to compute exact offsets with "omnipotent" knowledge of the system. |
| 87 static const int kMaxAllowedPlayoutErrorMs = 30; |
| 88 |
| 83 std::string ConvertFromBase16String(const std::string base_16) { | 89 std::string ConvertFromBase16String(const std::string base_16) { |
| 84 std::string compressed; | 90 std::string compressed; |
| 85 DCHECK_EQ(base_16.size() % 2, 0u) << "Must be a multiple of 2"; | 91 DCHECK_EQ(base_16.size() % 2, 0u) << "Must be a multiple of 2"; |
| 86 compressed.reserve(base_16.size() / 2); | 92 compressed.reserve(base_16.size() / 2); |
| 87 | 93 |
| 88 std::vector<uint8> v; | 94 std::vector<uint8> v; |
| 89 if (!base::HexStringToBytes(base_16, &v)) { | 95 if (!base::HexStringToBytes(base_16, &v)) { |
| 90 NOTREACHED(); | 96 NOTREACHED(); |
| 91 } | 97 } |
| 92 compressed.assign(reinterpret_cast<const char*>(&v[0]), v.size()); | 98 compressed.assign(reinterpret_cast<const char*>(&v[0]), v.size()); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 scoped_refptr<CastEnvironment> cast_environment_; | 243 scoped_refptr<CastEnvironment> cast_environment_; |
| 238 scoped_ptr<test::PacketPipe> packet_pipe_; | 244 scoped_ptr<test::PacketPipe> packet_pipe_; |
| 239 }; | 245 }; |
| 240 | 246 |
| 241 // Class that verifies the audio frames coming out of the receiver. | 247 // Class that verifies the audio frames coming out of the receiver. |
| 242 class TestReceiverAudioCallback | 248 class TestReceiverAudioCallback |
| 243 : public base::RefCountedThreadSafe<TestReceiverAudioCallback> { | 249 : public base::RefCountedThreadSafe<TestReceiverAudioCallback> { |
| 244 public: | 250 public: |
| 245 struct ExpectedAudioFrame { | 251 struct ExpectedAudioFrame { |
| 246 scoped_ptr<AudioBus> audio_bus; | 252 scoped_ptr<AudioBus> audio_bus; |
| 247 base::TimeTicks record_time; | 253 base::TimeTicks playout_time; |
| 248 }; | 254 }; |
| 249 | 255 |
| 250 TestReceiverAudioCallback() : num_called_(0) {} | 256 TestReceiverAudioCallback() : num_called_(0) {} |
| 251 | 257 |
| 252 void SetExpectedSamplingFrequency(int expected_sampling_frequency) { | 258 void SetExpectedSamplingFrequency(int expected_sampling_frequency) { |
| 253 expected_sampling_frequency_ = expected_sampling_frequency; | 259 expected_sampling_frequency_ = expected_sampling_frequency; |
| 254 } | 260 } |
| 255 | 261 |
| 256 void AddExpectedResult(const AudioBus& audio_bus, | 262 void AddExpectedResult(const AudioBus& audio_bus, |
| 257 const base::TimeTicks& record_time) { | 263 const base::TimeTicks& playout_time) { |
| 258 scoped_ptr<ExpectedAudioFrame> expected_audio_frame( | 264 scoped_ptr<ExpectedAudioFrame> expected_audio_frame( |
| 259 new ExpectedAudioFrame()); | 265 new ExpectedAudioFrame()); |
| 260 expected_audio_frame->audio_bus = | 266 expected_audio_frame->audio_bus = |
| 261 AudioBus::Create(audio_bus.channels(), audio_bus.frames()).Pass(); | 267 AudioBus::Create(audio_bus.channels(), audio_bus.frames()).Pass(); |
| 262 audio_bus.CopyTo(expected_audio_frame->audio_bus.get()); | 268 audio_bus.CopyTo(expected_audio_frame->audio_bus.get()); |
| 263 expected_audio_frame->record_time = record_time; | 269 expected_audio_frame->playout_time = playout_time; |
| 264 expected_frames_.push_back(expected_audio_frame.release()); | 270 expected_frames_.push_back(expected_audio_frame.release()); |
| 265 } | 271 } |
| 266 | 272 |
| 267 void IgnoreAudioFrame(scoped_ptr<AudioBus> audio_bus, | 273 void IgnoreAudioFrame(scoped_ptr<AudioBus> audio_bus, |
| 268 const base::TimeTicks& playout_time, | 274 const base::TimeTicks& playout_time, |
| 269 bool is_continuous) { | 275 bool is_continuous) { |
| 270 ++num_called_; | 276 ++num_called_; |
| 271 } | 277 } |
| 272 | 278 |
| 273 void CheckAudioFrame(scoped_ptr<AudioBus> audio_bus, | 279 void CheckAudioFrame(scoped_ptr<AudioBus> audio_bus, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 285 EXPECT_EQ(audio_bus->frames(), expected_audio_frame->audio_bus->frames()); | 291 EXPECT_EQ(audio_bus->frames(), expected_audio_frame->audio_bus->frames()); |
| 286 for (int ch = 0; ch < audio_bus->channels(); ++ch) { | 292 for (int ch = 0; ch < audio_bus->channels(); ++ch) { |
| 287 EXPECT_NEAR(CountZeroCrossings( | 293 EXPECT_NEAR(CountZeroCrossings( |
| 288 expected_audio_frame->audio_bus->channel(ch), | 294 expected_audio_frame->audio_bus->channel(ch), |
| 289 expected_audio_frame->audio_bus->frames()), | 295 expected_audio_frame->audio_bus->frames()), |
| 290 CountZeroCrossings(audio_bus->channel(ch), | 296 CountZeroCrossings(audio_bus->channel(ch), |
| 291 audio_bus->frames()), | 297 audio_bus->frames()), |
| 292 1); | 298 1); |
| 293 } | 299 } |
| 294 | 300 |
| 295 // TODO(miu): This is a "fuzzy" way to check the timestamps. We should be | 301 EXPECT_NEAR( |
| 296 // able to compute exact offsets with "omnipotent" knowledge of the system. | 302 (playout_time - expected_audio_frame->playout_time).InMillisecondsF(), |
| 297 const base::TimeTicks upper_bound = | 303 0.0, |
| 298 expected_audio_frame->record_time + | 304 kMaxAllowedPlayoutErrorMs); |
| 299 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs + | |
| 300 kTimerErrorMs); | |
| 301 EXPECT_GE(upper_bound, playout_time) | |
| 302 << "playout_time - upper_bound == " | |
| 303 << (playout_time - upper_bound).InMicroseconds() << " usec"; | |
| 304 | |
| 305 EXPECT_TRUE(is_continuous); | 305 EXPECT_TRUE(is_continuous); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void CheckCodedAudioFrame( | 308 void CheckCodedAudioFrame( |
| 309 scoped_ptr<transport::EncodedAudioFrame> audio_frame, | 309 scoped_ptr<transport::EncodedAudioFrame> audio_frame, |
| 310 const base::TimeTicks& playout_time) { | 310 const base::TimeTicks& playout_time) { |
| 311 ASSERT_TRUE(!!audio_frame); | 311 ASSERT_TRUE(!!audio_frame); |
| 312 ASSERT_FALSE(expected_frames_.empty()); | 312 ASSERT_FALSE(expected_frames_.empty()); |
| 313 const ExpectedAudioFrame& expected_audio_frame = | 313 const ExpectedAudioFrame& expected_audio_frame = |
| 314 *(expected_frames_.front()); | 314 *(expected_frames_.front()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 }; | 350 }; |
| 351 | 351 |
| 352 // Class that verifies the video frames coming out of the receiver. | 352 // Class that verifies the video frames coming out of the receiver. |
| 353 class TestReceiverVideoCallback | 353 class TestReceiverVideoCallback |
| 354 : public base::RefCountedThreadSafe<TestReceiverVideoCallback> { | 354 : public base::RefCountedThreadSafe<TestReceiverVideoCallback> { |
| 355 public: | 355 public: |
| 356 struct ExpectedVideoFrame { | 356 struct ExpectedVideoFrame { |
| 357 int start_value; | 357 int start_value; |
| 358 int width; | 358 int width; |
| 359 int height; | 359 int height; |
| 360 base::TimeTicks capture_time; | 360 base::TimeTicks playout_time; |
| 361 bool should_be_continuous; | 361 bool should_be_continuous; |
| 362 }; | 362 }; |
| 363 | 363 |
| 364 TestReceiverVideoCallback() : num_called_(0) {} | 364 TestReceiverVideoCallback() : num_called_(0) {} |
| 365 | 365 |
| 366 void AddExpectedResult(int start_value, | 366 void AddExpectedResult(int start_value, |
| 367 int width, | 367 int width, |
| 368 int height, | 368 int height, |
| 369 const base::TimeTicks& capture_time, | 369 const base::TimeTicks& playout_time, |
| 370 bool should_be_continuous) { | 370 bool should_be_continuous) { |
| 371 ExpectedVideoFrame expected_video_frame; | 371 ExpectedVideoFrame expected_video_frame; |
| 372 expected_video_frame.start_value = start_value; | 372 expected_video_frame.start_value = start_value; |
| 373 expected_video_frame.width = width; | 373 expected_video_frame.width = width; |
| 374 expected_video_frame.height = height; | 374 expected_video_frame.height = height; |
| 375 expected_video_frame.capture_time = capture_time; | 375 expected_video_frame.playout_time = playout_time; |
| 376 expected_video_frame.should_be_continuous = should_be_continuous; | 376 expected_video_frame.should_be_continuous = should_be_continuous; |
| 377 expected_frame_.push_back(expected_video_frame); | 377 expected_frame_.push_back(expected_video_frame); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void CheckVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 380 void CheckVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 381 const base::TimeTicks& render_time, | 381 const base::TimeTicks& playout_time, |
| 382 bool is_continuous) { | 382 bool is_continuous) { |
| 383 ++num_called_; | 383 ++num_called_; |
| 384 | 384 |
| 385 ASSERT_TRUE(!!video_frame); | 385 ASSERT_TRUE(!!video_frame); |
| 386 ASSERT_FALSE(expected_frame_.empty()); | 386 ASSERT_FALSE(expected_frame_.empty()); |
| 387 ExpectedVideoFrame expected_video_frame = expected_frame_.front(); | 387 ExpectedVideoFrame expected_video_frame = expected_frame_.front(); |
| 388 expected_frame_.pop_front(); | 388 expected_frame_.pop_front(); |
| 389 | 389 |
| 390 base::TimeDelta time_since_capture = | |
| 391 render_time - expected_video_frame.capture_time; | |
| 392 const base::TimeDelta upper_bound = base::TimeDelta::FromMilliseconds( | |
| 393 kDefaultRtpMaxDelayMs + kTimerErrorMs); | |
| 394 | |
| 395 // TODO(miu): This is a "fuzzy" way to check the timestamps. We should be | |
| 396 // able to compute exact offsets with "omnipotent" knowledge of the system. | |
| 397 EXPECT_GE(upper_bound, time_since_capture) | |
| 398 << "time_since_capture - upper_bound == " | |
| 399 << (time_since_capture - upper_bound).InMicroseconds() << " usec"; | |
| 400 // TODO(miu): I broke the concept of 100 ms target delay timing on the | |
| 401 // receiver side, but the logic for computing playout time really isn't any | |
| 402 // more broken than it was. This only affects the receiver, and is to be | |
| 403 // rectified in an soon-upcoming change. http://crbug.com/356942 | |
| 404 // EXPECT_LE(expected_video_frame.capture_time, render_time); | |
| 405 EXPECT_EQ(expected_video_frame.width, video_frame->visible_rect().width()); | 390 EXPECT_EQ(expected_video_frame.width, video_frame->visible_rect().width()); |
| 406 EXPECT_EQ(expected_video_frame.height, | 391 EXPECT_EQ(expected_video_frame.height, |
| 407 video_frame->visible_rect().height()); | 392 video_frame->visible_rect().height()); |
| 408 | 393 |
| 409 gfx::Size size(expected_video_frame.width, expected_video_frame.height); | 394 gfx::Size size(expected_video_frame.width, expected_video_frame.height); |
| 410 scoped_refptr<media::VideoFrame> expected_I420_frame = | 395 scoped_refptr<media::VideoFrame> expected_I420_frame = |
| 411 media::VideoFrame::CreateFrame( | 396 media::VideoFrame::CreateFrame( |
| 412 VideoFrame::I420, size, gfx::Rect(size), size, base::TimeDelta()); | 397 VideoFrame::I420, size, gfx::Rect(size), size, base::TimeDelta()); |
| 413 PopulateVideoFrame(expected_I420_frame, expected_video_frame.start_value); | 398 PopulateVideoFrame(expected_I420_frame, expected_video_frame.start_value); |
| 414 | 399 |
| 415 EXPECT_GE(I420PSNR(expected_I420_frame, video_frame), kVideoAcceptedPSNR); | 400 EXPECT_GE(I420PSNR(expected_I420_frame, video_frame), kVideoAcceptedPSNR); |
| 416 | 401 |
| 402 EXPECT_NEAR( |
| 403 (playout_time - expected_video_frame.playout_time).InMillisecondsF(), |
| 404 0.0, |
| 405 kMaxAllowedPlayoutErrorMs); |
| 406 |
| 417 EXPECT_EQ(expected_video_frame.should_be_continuous, is_continuous); | 407 EXPECT_EQ(expected_video_frame.should_be_continuous, is_continuous); |
| 418 } | 408 } |
| 419 | 409 |
| 420 int number_times_called() const { return num_called_; } | 410 int number_times_called() const { return num_called_; } |
| 421 | 411 |
| 422 protected: | 412 protected: |
| 423 virtual ~TestReceiverVideoCallback() {} | 413 virtual ~TestReceiverVideoCallback() {} |
| 424 | 414 |
| 425 private: | 415 private: |
| 426 friend class base::RefCountedThreadSafe<TestReceiverVideoCallback>; | 416 friend class base::RefCountedThreadSafe<TestReceiverVideoCallback>; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 cast_environment_sender_->Logging()->AddRawEventSubscriber( | 450 cast_environment_sender_->Logging()->AddRawEventSubscriber( |
| 461 &event_subscriber_sender_); | 451 &event_subscriber_sender_); |
| 462 } | 452 } |
| 463 | 453 |
| 464 void Configure(transport::VideoCodec video_codec, | 454 void Configure(transport::VideoCodec video_codec, |
| 465 transport::AudioCodec audio_codec, | 455 transport::AudioCodec audio_codec, |
| 466 int audio_sampling_frequency, | 456 int audio_sampling_frequency, |
| 467 bool external_audio_decoder, | 457 bool external_audio_decoder, |
| 468 int max_number_of_video_buffers_used) { | 458 int max_number_of_video_buffers_used) { |
| 469 audio_sender_config_.rtp_config.ssrc = 1; | 459 audio_sender_config_.rtp_config.ssrc = 1; |
| 460 audio_sender_config_.rtp_config.max_delay_ms = kTargetPlayoutDelayMs; |
| 470 audio_sender_config_.incoming_feedback_ssrc = 2; | 461 audio_sender_config_.incoming_feedback_ssrc = 2; |
| 471 audio_sender_config_.rtp_config.payload_type = 96; | 462 audio_sender_config_.rtp_config.payload_type = 96; |
| 472 audio_sender_config_.use_external_encoder = false; | 463 audio_sender_config_.use_external_encoder = false; |
| 473 audio_sender_config_.frequency = audio_sampling_frequency; | 464 audio_sender_config_.frequency = audio_sampling_frequency; |
| 474 audio_sender_config_.channels = kAudioChannels; | 465 audio_sender_config_.channels = kAudioChannels; |
| 475 audio_sender_config_.bitrate = kDefaultAudioEncoderBitrate; | 466 audio_sender_config_.bitrate = kDefaultAudioEncoderBitrate; |
| 476 audio_sender_config_.codec = audio_codec; | 467 audio_sender_config_.codec = audio_codec; |
| 477 | 468 |
| 478 audio_receiver_config_.feedback_ssrc = | 469 audio_receiver_config_.feedback_ssrc = |
| 479 audio_sender_config_.incoming_feedback_ssrc; | 470 audio_sender_config_.incoming_feedback_ssrc; |
| 480 audio_receiver_config_.incoming_ssrc = audio_sender_config_.rtp_config.ssrc; | 471 audio_receiver_config_.incoming_ssrc = audio_sender_config_.rtp_config.ssrc; |
| 472 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; |
| 481 audio_receiver_config_.rtp_payload_type = | 473 audio_receiver_config_.rtp_payload_type = |
| 482 audio_sender_config_.rtp_config.payload_type; | 474 audio_sender_config_.rtp_config.payload_type; |
| 483 audio_receiver_config_.use_external_decoder = external_audio_decoder; | 475 audio_receiver_config_.use_external_decoder = external_audio_decoder; |
| 484 audio_receiver_config_.frequency = audio_sender_config_.frequency; | 476 audio_receiver_config_.frequency = audio_sender_config_.frequency; |
| 485 audio_receiver_config_.channels = kAudioChannels; | 477 audio_receiver_config_.channels = kAudioChannels; |
| 486 audio_receiver_config_.codec = audio_sender_config_.codec; | 478 audio_receiver_config_.codec = audio_sender_config_.codec; |
| 487 | 479 |
| 488 test_receiver_audio_callback_->SetExpectedSamplingFrequency( | 480 test_receiver_audio_callback_->SetExpectedSamplingFrequency( |
| 489 audio_receiver_config_.frequency); | 481 audio_receiver_config_.frequency); |
| 490 | 482 |
| 491 video_sender_config_.rtp_config.ssrc = 3; | 483 video_sender_config_.rtp_config.ssrc = 3; |
| 484 video_sender_config_.rtp_config.max_delay_ms = kTargetPlayoutDelayMs; |
| 492 video_sender_config_.incoming_feedback_ssrc = 4; | 485 video_sender_config_.incoming_feedback_ssrc = 4; |
| 493 video_sender_config_.rtp_config.payload_type = 97; | 486 video_sender_config_.rtp_config.payload_type = 97; |
| 494 video_sender_config_.use_external_encoder = false; | 487 video_sender_config_.use_external_encoder = false; |
| 495 video_sender_config_.width = kVideoHdWidth; | 488 video_sender_config_.width = kVideoHdWidth; |
| 496 video_sender_config_.height = kVideoHdHeight; | 489 video_sender_config_.height = kVideoHdHeight; |
| 497 video_sender_config_.max_bitrate = 5000000; | 490 video_sender_config_.max_bitrate = 5000000; |
| 498 video_sender_config_.min_bitrate = 1000000; | 491 video_sender_config_.min_bitrate = 1000000; |
| 499 video_sender_config_.start_bitrate = 5000000; | 492 video_sender_config_.start_bitrate = 5000000; |
| 500 video_sender_config_.max_qp = 30; | 493 video_sender_config_.max_qp = 30; |
| 501 video_sender_config_.min_qp = 4; | 494 video_sender_config_.min_qp = 4; |
| 502 video_sender_config_.max_frame_rate = 30; | 495 video_sender_config_.max_frame_rate = 30; |
| 503 video_sender_config_.max_number_of_video_buffers_used = | 496 video_sender_config_.max_number_of_video_buffers_used = |
| 504 max_number_of_video_buffers_used; | 497 max_number_of_video_buffers_used; |
| 505 video_sender_config_.codec = video_codec; | 498 video_sender_config_.codec = video_codec; |
| 506 | 499 |
| 507 video_receiver_config_.feedback_ssrc = | 500 video_receiver_config_.feedback_ssrc = |
| 508 video_sender_config_.incoming_feedback_ssrc; | 501 video_sender_config_.incoming_feedback_ssrc; |
| 509 video_receiver_config_.incoming_ssrc = video_sender_config_.rtp_config.ssrc; | 502 video_receiver_config_.incoming_ssrc = video_sender_config_.rtp_config.ssrc; |
| 503 video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; |
| 510 video_receiver_config_.rtp_payload_type = | 504 video_receiver_config_.rtp_payload_type = |
| 511 video_sender_config_.rtp_config.payload_type; | 505 video_sender_config_.rtp_config.payload_type; |
| 512 video_receiver_config_.use_external_decoder = false; | 506 video_receiver_config_.use_external_decoder = false; |
| 513 video_receiver_config_.codec = video_sender_config_.codec; | 507 video_receiver_config_.codec = video_sender_config_.codec; |
| 514 } | 508 } |
| 515 | 509 |
| 516 void FeedAudioFrames(int count, bool will_be_checked) { | 510 void FeedAudioFrames(int count, bool will_be_checked) { |
| 517 for (int i = 0; i < count; ++i) { | 511 for (int i = 0; i < count; ++i) { |
| 518 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( | 512 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( |
| 519 base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs))); | 513 base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs))); |
| 520 const base::TimeTicks send_time = | 514 const base::TimeTicks capture_time = |
| 521 testing_clock_sender_->NowTicks() + | 515 testing_clock_sender_->NowTicks() + |
| 522 i * base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs); | 516 i * base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs); |
| 523 if (will_be_checked) | 517 if (will_be_checked) { |
| 524 test_receiver_audio_callback_->AddExpectedResult(*audio_bus, send_time); | 518 test_receiver_audio_callback_->AddExpectedResult( |
| 525 audio_frame_input_->InsertAudio(audio_bus.Pass(), send_time); | 519 *audio_bus, |
| 520 capture_time + |
| 521 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs)); |
| 522 } |
| 523 audio_frame_input_->InsertAudio(audio_bus.Pass(), capture_time); |
| 526 } | 524 } |
| 527 } | 525 } |
| 528 | 526 |
| 529 void FeedAudioFramesWithExpectedDelay(int count, | 527 void FeedAudioFramesWithExpectedDelay(int count, |
| 530 const base::TimeDelta& delay) { | 528 const base::TimeDelta& delay) { |
| 531 for (int i = 0; i < count; ++i) { | 529 for (int i = 0; i < count; ++i) { |
| 532 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( | 530 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( |
| 533 base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs))); | 531 base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs))); |
| 534 const base::TimeTicks send_time = | 532 const base::TimeTicks capture_time = |
| 535 testing_clock_sender_->NowTicks() + | 533 testing_clock_sender_->NowTicks() + |
| 536 i * base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs); | 534 i * base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs); |
| 537 test_receiver_audio_callback_->AddExpectedResult(*audio_bus, | 535 test_receiver_audio_callback_->AddExpectedResult( |
| 538 send_time + delay); | 536 *audio_bus, |
| 539 audio_frame_input_->InsertAudio(audio_bus.Pass(), send_time); | 537 capture_time + delay + |
| 538 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs)); |
| 539 audio_frame_input_->InsertAudio(audio_bus.Pass(), capture_time); |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 | 542 |
| 543 void RequestAudioFrames(int count, bool with_check) { | 543 void RequestAudioFrames(int count, bool with_check) { |
| 544 for (int i = 0; i < count; ++i) { | 544 for (int i = 0; i < count; ++i) { |
| 545 frame_receiver_->GetRawAudioFrame( | 545 frame_receiver_->GetRawAudioFrame( |
| 546 base::Bind(with_check ? &TestReceiverAudioCallback::CheckAudioFrame : | 546 base::Bind(with_check ? &TestReceiverAudioCallback::CheckAudioFrame : |
| 547 &TestReceiverAudioCallback::IgnoreAudioFrame, | 547 &TestReceiverAudioCallback::IgnoreAudioFrame, |
| 548 test_receiver_audio_callback_)); | 548 test_receiver_audio_callback_)); |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 void Create() { | 552 void Create() { |
| 553 cast_receiver_ = CastReceiver::Create(cast_environment_receiver_, | 553 cast_receiver_ = CastReceiver::Create(cast_environment_receiver_, |
| 554 audio_receiver_config_, | 554 audio_receiver_config_, |
| 555 video_receiver_config_, | 555 video_receiver_config_, |
| 556 &receiver_to_sender_); | 556 &receiver_to_sender_); |
| 557 |
| 557 net::IPEndPoint dummy_endpoint; | 558 net::IPEndPoint dummy_endpoint; |
| 558 transport_sender_.reset(new transport::CastTransportSenderImpl( | 559 transport_sender_.reset(new transport::CastTransportSenderImpl( |
| 559 NULL, | 560 NULL, |
| 560 testing_clock_sender_, | 561 testing_clock_sender_, |
| 561 dummy_endpoint, | 562 dummy_endpoint, |
| 562 base::Bind(&UpdateCastTransportStatus), | 563 base::Bind(&UpdateCastTransportStatus), |
| 563 base::Bind(&End2EndTest::LogRawEvents, base::Unretained(this)), | 564 base::Bind(&End2EndTest::LogRawEvents, base::Unretained(this)), |
| 564 base::TimeDelta::FromSeconds(1), | 565 base::TimeDelta::FromSeconds(1), |
| 565 task_runner_, | 566 task_runner_, |
| 566 &sender_to_receiver_)); | 567 &sender_to_receiver_)); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 const int num_audio_frames = audio_diff / kAudioFrameDurationMs; | 698 const int num_audio_frames = audio_diff / kAudioFrameDurationMs; |
| 698 audio_diff -= num_audio_frames * kAudioFrameDurationMs; | 699 audio_diff -= num_audio_frames * kAudioFrameDurationMs; |
| 699 | 700 |
| 700 if (num_audio_frames > 0) | 701 if (num_audio_frames > 0) |
| 701 FeedAudioFrames(1, true); | 702 FeedAudioFrames(1, true); |
| 702 | 703 |
| 703 test_receiver_video_callback_->AddExpectedResult( | 704 test_receiver_video_callback_->AddExpectedResult( |
| 704 video_start, | 705 video_start, |
| 705 video_sender_config_.width, | 706 video_sender_config_.width, |
| 706 video_sender_config_.height, | 707 video_sender_config_.height, |
| 707 testing_clock_sender_->NowTicks(), | 708 testing_clock_sender_->NowTicks() + |
| 709 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 708 true); | 710 true); |
| 709 SendVideoFrame(video_start, testing_clock_sender_->NowTicks()); | 711 SendVideoFrame(video_start, testing_clock_sender_->NowTicks()); |
| 710 | 712 |
| 711 if (num_audio_frames > 0) | 713 if (num_audio_frames > 0) |
| 712 RunTasks(kAudioFrameDurationMs); // Advance clock forward. | 714 RunTasks(kAudioFrameDurationMs); // Advance clock forward. |
| 713 if (num_audio_frames > 1) | 715 if (num_audio_frames > 1) |
| 714 FeedAudioFrames(num_audio_frames - 1, true); | 716 FeedAudioFrames(num_audio_frames - 1, true); |
| 715 | 717 |
| 716 RequestAudioFrames(num_audio_frames, true); | 718 RequestAudioFrames(num_audio_frames, true); |
| 717 num_audio_frames_requested += num_audio_frames; | 719 num_audio_frames_requested += num_audio_frames; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 if (num_audio_frames > 0) | 804 if (num_audio_frames > 0) |
| 803 FeedAudioFramesWithExpectedDelay(1, expected_delay); | 805 FeedAudioFramesWithExpectedDelay(1, expected_delay); |
| 804 | 806 |
| 805 // Frame will be rendered with 100mS delay, as the transmission is delayed. | 807 // Frame will be rendered with 100mS delay, as the transmission is delayed. |
| 806 // The receiver at this point cannot be synced to the sender's clock, as no | 808 // The receiver at this point cannot be synced to the sender's clock, as no |
| 807 // packets, and specifically no RTCP packets were sent. | 809 // packets, and specifically no RTCP packets were sent. |
| 808 test_receiver_video_callback_->AddExpectedResult( | 810 test_receiver_video_callback_->AddExpectedResult( |
| 809 video_start, | 811 video_start, |
| 810 video_sender_config_.width, | 812 video_sender_config_.width, |
| 811 video_sender_config_.height, | 813 video_sender_config_.height, |
| 812 initial_send_time + expected_delay, | 814 initial_send_time + expected_delay + |
| 815 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 813 true); | 816 true); |
| 814 SendVideoFrame(video_start, testing_clock_sender_->NowTicks()); | 817 SendVideoFrame(video_start, testing_clock_sender_->NowTicks()); |
| 815 | 818 |
| 816 if (num_audio_frames > 0) | 819 if (num_audio_frames > 0) |
| 817 RunTasks(kAudioFrameDurationMs); // Advance clock forward. | 820 RunTasks(kAudioFrameDurationMs); // Advance clock forward. |
| 818 if (num_audio_frames > 1) | 821 if (num_audio_frames > 1) |
| 819 FeedAudioFramesWithExpectedDelay(num_audio_frames - 1, expected_delay); | 822 FeedAudioFramesWithExpectedDelay(num_audio_frames - 1, expected_delay); |
| 820 | 823 |
| 821 RunTasks(kFrameTimerMs - kAudioFrameDurationMs); | 824 RunTasks(kFrameTimerMs - kAudioFrameDurationMs); |
| 822 audio_diff += kFrameTimerMs; | 825 audio_diff += kFrameTimerMs; |
| 823 video_start++; | 826 video_start++; |
| 824 } | 827 } |
| 825 | 828 |
| 826 RunTasks(test_delay_ms); | 829 RunTasks(test_delay_ms); |
| 827 sender_to_receiver_.SetSendPackets(true); | 830 sender_to_receiver_.SetSendPackets(true); |
| 828 | 831 |
| 829 int num_audio_frames_requested = 0; | 832 int num_audio_frames_requested = 0; |
| 830 for (int j = 0; j < 10; ++j) { | 833 for (int j = 0; j < 10; ++j) { |
| 831 const int num_audio_frames = audio_diff / kAudioFrameDurationMs; | 834 const int num_audio_frames = audio_diff / kAudioFrameDurationMs; |
| 832 audio_diff -= num_audio_frames * kAudioFrameDurationMs; | 835 audio_diff -= num_audio_frames * kAudioFrameDurationMs; |
| 833 | 836 |
| 834 if (num_audio_frames > 0) | 837 if (num_audio_frames > 0) |
| 835 FeedAudioFrames(1, true); | 838 FeedAudioFrames(1, true); |
| 836 | 839 |
| 837 test_receiver_video_callback_->AddExpectedResult( | 840 test_receiver_video_callback_->AddExpectedResult( |
| 838 video_start, | 841 video_start, |
| 839 video_sender_config_.width, | 842 video_sender_config_.width, |
| 840 video_sender_config_.height, | 843 video_sender_config_.height, |
| 841 testing_clock_sender_->NowTicks(), | 844 testing_clock_sender_->NowTicks() + |
| 845 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 842 true); | 846 true); |
| 843 SendVideoFrame(video_start, testing_clock_sender_->NowTicks()); | 847 SendVideoFrame(video_start, testing_clock_sender_->NowTicks()); |
| 844 | 848 |
| 845 if (num_audio_frames > 0) | 849 if (num_audio_frames > 0) |
| 846 RunTasks(kAudioFrameDurationMs); // Advance clock forward. | 850 RunTasks(kAudioFrameDurationMs); // Advance clock forward. |
| 847 if (num_audio_frames > 1) | 851 if (num_audio_frames > 1) |
| 848 FeedAudioFrames(num_audio_frames - 1, true); | 852 FeedAudioFrames(num_audio_frames - 1, true); |
| 849 | 853 |
| 850 RequestAudioFrames(num_audio_frames, true); | 854 RequestAudioFrames(num_audio_frames, true); |
| 851 num_audio_frames_requested += num_audio_frames; | 855 num_audio_frames_requested += num_audio_frames; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 867 // This tests a network glitch lasting for 10 video frames. | 871 // This tests a network glitch lasting for 10 video frames. |
| 868 // Flaky. See crbug.com/351596. | 872 // Flaky. See crbug.com/351596. |
| 869 TEST_F(End2EndTest, DISABLED_GlitchWith3Buffers) { | 873 TEST_F(End2EndTest, DISABLED_GlitchWith3Buffers) { |
| 870 Configure(transport::kVp8, transport::kOpus, kDefaultAudioSamplingRate, | 874 Configure(transport::kVp8, transport::kOpus, kDefaultAudioSamplingRate, |
| 871 false, 3); | 875 false, 3); |
| 872 video_sender_config_.rtp_config.max_delay_ms = 67; | 876 video_sender_config_.rtp_config.max_delay_ms = 67; |
| 873 video_receiver_config_.rtp_max_delay_ms = 67; | 877 video_receiver_config_.rtp_max_delay_ms = 67; |
| 874 Create(); | 878 Create(); |
| 875 | 879 |
| 876 int video_start = kVideoStart; | 880 int video_start = kVideoStart; |
| 877 base::TimeTicks send_time; | 881 base::TimeTicks capture_time; |
| 878 // Frames will rendered on completion until the render time stabilizes, i.e. | 882 // Frames will rendered on completion until the render time stabilizes, i.e. |
| 879 // we got enough data. | 883 // we got enough data. |
| 880 const int frames_before_glitch = 20; | 884 const int frames_before_glitch = 20; |
| 881 for (int i = 0; i < frames_before_glitch; ++i) { | 885 for (int i = 0; i < frames_before_glitch; ++i) { |
| 882 send_time = testing_clock_sender_->NowTicks(); | 886 capture_time = testing_clock_sender_->NowTicks(); |
| 883 SendVideoFrame(video_start, send_time); | 887 SendVideoFrame(video_start, capture_time); |
| 884 test_receiver_video_callback_->AddExpectedResult( | 888 test_receiver_video_callback_->AddExpectedResult( |
| 885 video_start, | 889 video_start, |
| 886 video_sender_config_.width, | 890 video_sender_config_.width, |
| 887 video_sender_config_.height, | 891 video_sender_config_.height, |
| 888 send_time, | 892 capture_time + base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 889 true); | 893 true); |
| 890 frame_receiver_->GetRawVideoFrame( | 894 frame_receiver_->GetRawVideoFrame( |
| 891 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, | 895 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, |
| 892 test_receiver_video_callback_)); | 896 test_receiver_video_callback_)); |
| 893 RunTasks(kFrameTimerMs); | 897 RunTasks(kFrameTimerMs); |
| 894 video_start++; | 898 video_start++; |
| 895 } | 899 } |
| 896 | 900 |
| 897 // Introduce a glitch lasting for 10 frames. | 901 // Introduce a glitch lasting for 10 frames. |
| 898 sender_to_receiver_.SetSendPackets(false); | 902 sender_to_receiver_.SetSendPackets(false); |
| 899 for (int i = 0; i < 10; ++i) { | 903 for (int i = 0; i < 10; ++i) { |
| 900 send_time = testing_clock_sender_->NowTicks(); | 904 capture_time = testing_clock_sender_->NowTicks(); |
| 901 // First 3 will be sent and lost. | 905 // First 3 will be sent and lost. |
| 902 SendVideoFrame(video_start, send_time); | 906 SendVideoFrame(video_start, capture_time); |
| 903 RunTasks(kFrameTimerMs); | 907 RunTasks(kFrameTimerMs); |
| 904 video_start++; | 908 video_start++; |
| 905 } | 909 } |
| 906 sender_to_receiver_.SetSendPackets(true); | 910 sender_to_receiver_.SetSendPackets(true); |
| 907 RunTasks(100); | 911 RunTasks(100); |
| 908 send_time = testing_clock_sender_->NowTicks(); | 912 capture_time = testing_clock_sender_->NowTicks(); |
| 909 | 913 |
| 910 // Frame 1 should be acked by now and we should have an opening to send 4. | 914 // Frame 1 should be acked by now and we should have an opening to send 4. |
| 911 SendVideoFrame(video_start, send_time); | 915 SendVideoFrame(video_start, capture_time); |
| 912 RunTasks(kFrameTimerMs); | 916 RunTasks(kFrameTimerMs); |
| 913 | 917 |
| 914 // Frames 1-3 are old frames by now, and therefore should be decoded, but | 918 // Frames 1-3 are old frames by now, and therefore should be decoded, but |
| 915 // not rendered. The next frame we expect to render is frame #4. | 919 // not rendered. The next frame we expect to render is frame #4. |
| 916 test_receiver_video_callback_->AddExpectedResult(video_start, | 920 test_receiver_video_callback_->AddExpectedResult( |
| 917 video_sender_config_.width, | 921 video_start, |
| 918 video_sender_config_.height, | 922 video_sender_config_.width, |
| 919 send_time, | 923 video_sender_config_.height, |
| 920 true); | 924 capture_time + base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 925 true); |
| 921 | 926 |
| 922 frame_receiver_->GetRawVideoFrame( | 927 frame_receiver_->GetRawVideoFrame( |
| 923 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, | 928 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, |
| 924 test_receiver_video_callback_)); | 929 test_receiver_video_callback_)); |
| 925 | 930 |
| 926 RunTasks(2 * kFrameTimerMs + 1); // Empty the receiver pipeline. | 931 RunTasks(2 * kFrameTimerMs + 1); // Empty the receiver pipeline. |
| 927 EXPECT_EQ(frames_before_glitch + 1, | 932 EXPECT_EQ(frames_before_glitch + 1, |
| 928 test_receiver_video_callback_->number_times_called()); | 933 test_receiver_video_callback_->number_times_called()); |
| 929 } | 934 } |
| 930 | 935 |
| 931 // Disabled due to flakiness and crashiness. http://crbug.com/360951 | 936 // Disabled due to flakiness and crashiness. http://crbug.com/360951 |
| 932 TEST_F(End2EndTest, DISABLED_DropEveryOtherFrame3Buffers) { | 937 TEST_F(End2EndTest, DISABLED_DropEveryOtherFrame3Buffers) { |
| 933 Configure(transport::kVp8, transport::kOpus, kDefaultAudioSamplingRate, false, | 938 Configure(transport::kVp8, transport::kOpus, kDefaultAudioSamplingRate, false, |
| 934 3); | 939 3); |
| 935 video_sender_config_.rtp_config.max_delay_ms = 67; | 940 video_sender_config_.rtp_config.max_delay_ms = 67; |
| 936 video_receiver_config_.rtp_max_delay_ms = 67; | 941 video_receiver_config_.rtp_max_delay_ms = 67; |
| 937 Create(); | 942 Create(); |
| 938 sender_to_receiver_.DropAllPacketsBelongingToOddFrames(); | 943 sender_to_receiver_.DropAllPacketsBelongingToOddFrames(); |
| 939 | 944 |
| 940 int video_start = kVideoStart; | 945 int video_start = kVideoStart; |
| 941 base::TimeTicks send_time; | 946 base::TimeTicks capture_time; |
| 942 | 947 |
| 943 int i = 0; | 948 int i = 0; |
| 944 for (; i < 20; ++i) { | 949 for (; i < 20; ++i) { |
| 945 send_time = testing_clock_sender_->NowTicks(); | 950 capture_time = testing_clock_sender_->NowTicks(); |
| 946 SendVideoFrame(video_start, send_time); | 951 SendVideoFrame(video_start, capture_time); |
| 947 | 952 |
| 948 if (i % 2 == 0) { | 953 if (i % 2 == 0) { |
| 949 test_receiver_video_callback_->AddExpectedResult( | 954 test_receiver_video_callback_->AddExpectedResult( |
| 950 video_start, | 955 video_start, |
| 951 video_sender_config_.width, | 956 video_sender_config_.width, |
| 952 video_sender_config_.height, | 957 video_sender_config_.height, |
| 953 send_time, | 958 capture_time + |
| 959 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 954 i == 0); | 960 i == 0); |
| 955 | 961 |
| 956 // GetRawVideoFrame will not return the frame until we are close in | 962 // GetRawVideoFrame will not return the frame until we are close in |
| 957 // time before we should render the frame. | 963 // time before we should render the frame. |
| 958 frame_receiver_->GetRawVideoFrame( | 964 frame_receiver_->GetRawVideoFrame( |
| 959 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, | 965 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, |
| 960 test_receiver_video_callback_)); | 966 test_receiver_video_callback_)); |
| 961 } | 967 } |
| 962 RunTasks(kFrameTimerMs); | 968 RunTasks(kFrameTimerMs); |
| 963 video_start++; | 969 video_start++; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 977 | 983 |
| 978 video_receiver_config_.aes_iv_mask = | 984 video_receiver_config_.aes_iv_mask = |
| 979 video_sender_config_.rtp_config.aes_iv_mask; | 985 video_sender_config_.rtp_config.aes_iv_mask; |
| 980 video_receiver_config_.aes_key = | 986 video_receiver_config_.aes_key = |
| 981 video_sender_config_.rtp_config.aes_key; | 987 video_sender_config_.rtp_config.aes_key; |
| 982 | 988 |
| 983 Create(); | 989 Create(); |
| 984 | 990 |
| 985 int frames_counter = 0; | 991 int frames_counter = 0; |
| 986 for (; frames_counter < 3; ++frames_counter) { | 992 for (; frames_counter < 3; ++frames_counter) { |
| 987 const base::TimeTicks send_time = testing_clock_sender_->NowTicks(); | 993 const base::TimeTicks capture_time = testing_clock_sender_->NowTicks(); |
| 988 SendVideoFrame(frames_counter, send_time); | 994 SendVideoFrame(frames_counter, capture_time); |
| 989 | 995 |
| 990 test_receiver_video_callback_->AddExpectedResult( | 996 test_receiver_video_callback_->AddExpectedResult( |
| 991 frames_counter, | 997 frames_counter, |
| 992 video_sender_config_.width, | 998 video_sender_config_.width, |
| 993 video_sender_config_.height, | 999 video_sender_config_.height, |
| 994 send_time, | 1000 capture_time + base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 995 true); | 1001 true); |
| 996 | 1002 |
| 997 RunTasks(kFrameTimerMs); | 1003 RunTasks(kFrameTimerMs); |
| 998 | 1004 |
| 999 frame_receiver_->GetRawVideoFrame( | 1005 frame_receiver_->GetRawVideoFrame( |
| 1000 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, | 1006 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, |
| 1001 test_receiver_video_callback_)); | 1007 test_receiver_video_callback_)); |
| 1002 } | 1008 } |
| 1003 RunTasks(2 * kFrameTimerMs + 1); // Empty the pipeline. | 1009 RunTasks(2 * kFrameTimerMs + 1); // Empty the pipeline. |
| 1004 EXPECT_EQ(frames_counter, | 1010 EXPECT_EQ(frames_counter, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1034 | 1040 |
| 1035 // Video test without packet loss - tests the logging aspects of the end2end, | 1041 // Video test without packet loss - tests the logging aspects of the end2end, |
| 1036 // but is basically equivalent to LoopNoLossPcm16. | 1042 // but is basically equivalent to LoopNoLossPcm16. |
| 1037 TEST_F(End2EndTest, VideoLogging) { | 1043 TEST_F(End2EndTest, VideoLogging) { |
| 1038 Configure(transport::kVp8, transport::kPcm16, 32000, false, 1); | 1044 Configure(transport::kVp8, transport::kPcm16, 32000, false, 1); |
| 1039 Create(); | 1045 Create(); |
| 1040 | 1046 |
| 1041 int video_start = kVideoStart; | 1047 int video_start = kVideoStart; |
| 1042 const int num_frames = 5; | 1048 const int num_frames = 5; |
| 1043 for (int i = 0; i < num_frames; ++i) { | 1049 for (int i = 0; i < num_frames; ++i) { |
| 1044 base::TimeTicks send_time = testing_clock_sender_->NowTicks(); | 1050 base::TimeTicks capture_time = testing_clock_sender_->NowTicks(); |
| 1045 test_receiver_video_callback_->AddExpectedResult( | 1051 test_receiver_video_callback_->AddExpectedResult( |
| 1046 video_start, | 1052 video_start, |
| 1047 video_sender_config_.width, | 1053 video_sender_config_.width, |
| 1048 video_sender_config_.height, | 1054 video_sender_config_.height, |
| 1049 send_time, | 1055 capture_time + base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs), |
| 1050 true); | 1056 true); |
| 1051 | 1057 |
| 1052 SendVideoFrame(video_start, send_time); | 1058 SendVideoFrame(video_start, capture_time); |
| 1053 RunTasks(kFrameTimerMs); | 1059 RunTasks(kFrameTimerMs); |
| 1054 | 1060 |
| 1055 frame_receiver_->GetRawVideoFrame( | 1061 frame_receiver_->GetRawVideoFrame( |
| 1056 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, | 1062 base::Bind(&TestReceiverVideoCallback::CheckVideoFrame, |
| 1057 test_receiver_video_callback_)); | 1063 test_receiver_video_callback_)); |
| 1058 | 1064 |
| 1059 video_start++; | 1065 video_start++; |
| 1060 } | 1066 } |
| 1061 | 1067 |
| 1062 // Basic tests. | 1068 // Basic tests. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 EXPECT_EQ(1000, received_counter); | 1258 EXPECT_EQ(1000, received_counter); |
| 1253 } | 1259 } |
| 1254 | 1260 |
| 1255 // TODO(pwestin): Add repeatable packet loss test. | 1261 // TODO(pwestin): Add repeatable packet loss test. |
| 1256 // TODO(pwestin): Add test for misaligned send get calls. | 1262 // TODO(pwestin): Add test for misaligned send get calls. |
| 1257 // TODO(pwestin): Add more tests that does not resample. | 1263 // TODO(pwestin): Add more tests that does not resample. |
| 1258 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1264 // TODO(pwestin): Add test when we have starvation for our RunTask. |
| 1259 | 1265 |
| 1260 } // namespace cast | 1266 } // namespace cast |
| 1261 } // namespace media | 1267 } // namespace media |
| OLD | NEW |