| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Dummy callback function that does nothing except to accept ownership of | 88 // Dummy callback function that does nothing except to accept ownership of |
| 89 // |audio_bus| for destruction. | 89 // |audio_bus| for destruction. |
| 90 void OwnThatAudioBus(scoped_ptr<AudioBus> audio_bus) {} | 90 void OwnThatAudioBus(scoped_ptr<AudioBus> audio_bus) {} |
| 91 | 91 |
| 92 void UpdateCastTransportStatus(transport::CastTransportStatus status) { | 92 void UpdateCastTransportStatus(transport::CastTransportStatus status) { |
| 93 bool result = (status == transport::TRANSPORT_AUDIO_INITIALIZED || | 93 bool result = (status == transport::TRANSPORT_AUDIO_INITIALIZED || |
| 94 status == transport::TRANSPORT_VIDEO_INITIALIZED); | 94 status == transport::TRANSPORT_VIDEO_INITIALIZED); |
| 95 EXPECT_TRUE(result); | 95 EXPECT_TRUE(result); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void AudioInitializationStatus(CastInitializationStatus status) { |
| 99 EXPECT_EQ(STATUS_AUDIO_INITIALIZED, status); |
| 100 } |
| 101 |
| 102 void VideoInitializationStatus(CastInitializationStatus status) { |
| 103 EXPECT_EQ(STATUS_VIDEO_INITIALIZED, status); |
| 104 } |
| 105 |
| 98 // This is wrapped in a struct because it needs to be put into a std::map. | 106 // This is wrapped in a struct because it needs to be put into a std::map. |
| 99 typedef struct { | 107 typedef struct { |
| 100 int counter[kNumOfLoggingEvents]; | 108 int counter[kNumOfLoggingEvents]; |
| 101 } LoggingEventCounts; | 109 } LoggingEventCounts; |
| 102 | 110 |
| 103 // Constructs a map from each frame (RTP timestamp) to counts of each event | 111 // Constructs a map from each frame (RTP timestamp) to counts of each event |
| 104 // type logged for that frame. | 112 // type logged for that frame. |
| 105 std::map<RtpTimestamp, LoggingEventCounts> GetEventCountForFrameEvents( | 113 std::map<RtpTimestamp, LoggingEventCounts> GetEventCountForFrameEvents( |
| 106 const std::vector<FrameEvent>& frame_events) { | 114 const std::vector<FrameEvent>& frame_events) { |
| 107 std::map<RtpTimestamp, LoggingEventCounts> event_counter_for_frame; | 115 std::map<RtpTimestamp, LoggingEventCounts> event_counter_for_frame; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 }; | 397 }; |
| 390 | 398 |
| 391 // The actual test class, generate synthetic data for both audio and video and | 399 // The actual test class, generate synthetic data for both audio and video and |
| 392 // send those through the sender and receiver and analyzes the result. | 400 // send those through the sender and receiver and analyzes the result. |
| 393 class End2EndTest : public ::testing::Test { | 401 class End2EndTest : public ::testing::Test { |
| 394 protected: | 402 protected: |
| 395 End2EndTest() | 403 End2EndTest() |
| 396 : start_time_(), | 404 : start_time_(), |
| 397 testing_clock_sender_(new base::SimpleTestTickClock()), | 405 testing_clock_sender_(new base::SimpleTestTickClock()), |
| 398 testing_clock_receiver_(new base::SimpleTestTickClock()), | 406 testing_clock_receiver_(new base::SimpleTestTickClock()), |
| 399 task_runner_(new test::FakeSingleThreadTaskRunner( | 407 task_runner_( |
| 400 testing_clock_sender_)), | 408 new test::FakeSingleThreadTaskRunner(testing_clock_sender_)), |
| 401 cast_environment_sender_(new CastEnvironment( | 409 cast_environment_sender_(new CastEnvironment( |
| 402 scoped_ptr<base::TickClock>(testing_clock_sender_).Pass(), | 410 scoped_ptr<base::TickClock>(testing_clock_sender_).Pass(), |
| 403 task_runner_, | 411 task_runner_, |
| 404 task_runner_, | 412 task_runner_, |
| 405 task_runner_, | 413 task_runner_, |
| 406 task_runner_, | 414 task_runner_, |
| 407 task_runner_, | 415 task_runner_, |
| 408 task_runner_, | 416 task_runner_, |
| 409 GetLoggingConfigWithRawEventsAndStatsEnabled())), | 417 GetLoggingConfigWithRawEventsAndStatsEnabled())), |
| 410 cast_environment_receiver_(new CastEnvironment( | 418 cast_environment_receiver_(new CastEnvironment( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 transport_audio_config_.codec = audio_sender_config_.codec; | 492 transport_audio_config_.codec = audio_sender_config_.codec; |
| 485 transport_audio_config_.base.rtp_config = audio_sender_config_.rtp_config; | 493 transport_audio_config_.base.rtp_config = audio_sender_config_.rtp_config; |
| 486 transport_audio_config_.frequency = audio_sender_config_.frequency; | 494 transport_audio_config_.frequency = audio_sender_config_.frequency; |
| 487 transport_audio_config_.channels = audio_sender_config_.channels; | 495 transport_audio_config_.channels = audio_sender_config_.channels; |
| 488 transport_video_config_.base.ssrc = video_sender_config_.sender_ssrc; | 496 transport_video_config_.base.ssrc = video_sender_config_.sender_ssrc; |
| 489 transport_video_config_.codec = video_sender_config_.codec; | 497 transport_video_config_.codec = video_sender_config_.codec; |
| 490 transport_video_config_.base.rtp_config = video_sender_config_.rtp_config; | 498 transport_video_config_.base.rtp_config = video_sender_config_.rtp_config; |
| 491 } | 499 } |
| 492 | 500 |
| 493 void Create() { | 501 void Create() { |
| 494 cast_receiver_.reset( | 502 cast_receiver_ = CastReceiver::Create(cast_environment_receiver_, |
| 495 CastReceiver::CreateCastReceiver(cast_environment_receiver_, | 503 audio_receiver_config_, |
| 496 audio_receiver_config_, | 504 video_receiver_config_, |
| 497 video_receiver_config_, | 505 &receiver_to_sender_); |
| 498 &receiver_to_sender_)); | |
| 499 net::IPEndPoint dummy_endpoint; | 506 net::IPEndPoint dummy_endpoint; |
| 500 transport_sender_.reset(new transport::CastTransportSenderImpl( | 507 transport_sender_.reset(new transport::CastTransportSenderImpl( |
| 501 NULL, | 508 NULL, |
| 502 testing_clock_sender_, | 509 testing_clock_sender_, |
| 503 dummy_endpoint, | 510 dummy_endpoint, |
| 504 dummy_endpoint, | 511 dummy_endpoint, |
| 505 base::Bind(&UpdateCastTransportStatus), | 512 base::Bind(&UpdateCastTransportStatus), |
| 506 task_runner_, | 513 task_runner_, |
| 507 &sender_to_receiver_)); | 514 &sender_to_receiver_)); |
| 508 transport_sender_->InitializeAudio(transport_audio_config_); | 515 transport_sender_->InitializeAudio(transport_audio_config_); |
| 509 transport_sender_->InitializeVideo(transport_video_config_); | 516 transport_sender_->InitializeVideo(transport_video_config_); |
| 510 | 517 |
| 511 cast_sender_.reset(CastSender::CreateCastSender( | 518 cast_sender_ = |
| 512 cast_environment_sender_, | 519 CastSender::Create(cast_environment_sender_, transport_sender_.get()); |
| 513 &audio_sender_config_, | 520 |
| 514 &video_sender_config_, | 521 // Initializing audio and video senders. |
| 515 NULL, | 522 cast_sender_->InitializeAudio( |
| 516 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)), | 523 audio_sender_config_, |
| 517 transport_sender_.get())); | 524 base::Bind(&AudioInitializationStatus)); |
| 525 cast_sender_->InitializeVideo( |
| 526 video_sender_config_, |
| 527 base::Bind(&VideoInitializationStatus), |
| 528 NULL); |
| 518 | 529 |
| 519 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); | 530 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); |
| 520 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); | 531 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); |
| 521 | 532 |
| 522 frame_input_ = cast_sender_->frame_input(); | 533 audio_frame_input_ = cast_sender_->audio_frame_input(); |
| 534 video_frame_input_ = cast_sender_->video_frame_input(); |
| 535 |
| 523 frame_receiver_ = cast_receiver_->frame_receiver(); | 536 frame_receiver_ = cast_receiver_->frame_receiver(); |
| 524 | 537 |
| 525 audio_bus_factory_.reset( | 538 audio_bus_factory_.reset( |
| 526 new TestAudioBusFactory(audio_sender_config_.channels, | 539 new TestAudioBusFactory(audio_sender_config_.channels, |
| 527 audio_sender_config_.frequency, | 540 audio_sender_config_.frequency, |
| 528 kSoundFrequency, | 541 kSoundFrequency, |
| 529 kSoundVolume)); | 542 kSoundVolume)); |
| 530 } | 543 } |
| 531 | 544 |
| 532 virtual ~End2EndTest() { | 545 virtual ~End2EndTest() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 544 if (start_time_.is_null()) | 557 if (start_time_.is_null()) |
| 545 start_time_ = capture_time; | 558 start_time_ = capture_time; |
| 546 base::TimeDelta time_diff = capture_time - start_time_; | 559 base::TimeDelta time_diff = capture_time - start_time_; |
| 547 gfx::Size size(video_sender_config_.width, video_sender_config_.height); | 560 gfx::Size size(video_sender_config_.width, video_sender_config_.height); |
| 548 EXPECT_TRUE(VideoFrame::IsValidConfig( | 561 EXPECT_TRUE(VideoFrame::IsValidConfig( |
| 549 VideoFrame::I420, size, gfx::Rect(size), size)); | 562 VideoFrame::I420, size, gfx::Rect(size), size)); |
| 550 scoped_refptr<media::VideoFrame> video_frame = | 563 scoped_refptr<media::VideoFrame> video_frame = |
| 551 media::VideoFrame::CreateFrame( | 564 media::VideoFrame::CreateFrame( |
| 552 VideoFrame::I420, size, gfx::Rect(size), size, time_diff); | 565 VideoFrame::I420, size, gfx::Rect(size), size, time_diff); |
| 553 PopulateVideoFrame(video_frame, start_value); | 566 PopulateVideoFrame(video_frame, start_value); |
| 554 frame_input_->InsertRawVideoFrame(video_frame, capture_time); | 567 video_frame_input_->InsertRawVideoFrame(video_frame, capture_time); |
| 555 } | 568 } |
| 556 | 569 |
| 557 void RunTasks(int during_ms) { | 570 void RunTasks(int during_ms) { |
| 558 for (int i = 0; i < during_ms; ++i) { | 571 for (int i = 0; i < during_ms; ++i) { |
| 559 // Call process the timers every 1 ms. | 572 // Call process the timers every 1 ms. |
| 560 testing_clock_sender_->Advance(base::TimeDelta::FromMilliseconds(1)); | 573 testing_clock_sender_->Advance(base::TimeDelta::FromMilliseconds(1)); |
| 561 testing_clock_receiver_->Advance(base::TimeDelta::FromMilliseconds(1)); | 574 testing_clock_receiver_->Advance(base::TimeDelta::FromMilliseconds(1)); |
| 562 task_runner_->RunTasks(); | 575 task_runner_->RunTasks(); |
| 563 } | 576 } |
| 564 } | 577 } |
| 565 | 578 |
| 566 void InitializationResult(CastInitializationStatus result) { | |
| 567 EXPECT_EQ(result, STATUS_INITIALIZED); | |
| 568 } | |
| 569 | |
| 570 AudioReceiverConfig audio_receiver_config_; | 579 AudioReceiverConfig audio_receiver_config_; |
| 571 VideoReceiverConfig video_receiver_config_; | 580 VideoReceiverConfig video_receiver_config_; |
| 572 AudioSenderConfig audio_sender_config_; | 581 AudioSenderConfig audio_sender_config_; |
| 573 VideoSenderConfig video_sender_config_; | 582 VideoSenderConfig video_sender_config_; |
| 574 transport::CastTransportAudioConfig transport_audio_config_; | 583 transport::CastTransportAudioConfig transport_audio_config_; |
| 575 transport::CastTransportVideoConfig transport_video_config_; | 584 transport::CastTransportVideoConfig transport_video_config_; |
| 576 | 585 |
| 577 base::TimeTicks start_time_; | 586 base::TimeTicks start_time_; |
| 578 base::SimpleTestTickClock* testing_clock_sender_; | 587 base::SimpleTestTickClock* testing_clock_sender_; |
| 579 base::SimpleTestTickClock* testing_clock_receiver_; | 588 base::SimpleTestTickClock* testing_clock_receiver_; |
| 580 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 589 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
| 581 scoped_refptr<CastEnvironment> cast_environment_sender_; | 590 scoped_refptr<CastEnvironment> cast_environment_sender_; |
| 582 scoped_refptr<CastEnvironment> cast_environment_receiver_; | 591 scoped_refptr<CastEnvironment> cast_environment_receiver_; |
| 583 | 592 |
| 584 LoopBackTransport receiver_to_sender_; | 593 LoopBackTransport receiver_to_sender_; |
| 585 LoopBackTransport sender_to_receiver_; | 594 LoopBackTransport sender_to_receiver_; |
| 586 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; | 595 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; |
| 587 | 596 |
| 588 scoped_ptr<CastReceiver> cast_receiver_; | 597 scoped_ptr<CastReceiver> cast_receiver_; |
| 589 scoped_ptr<CastSender> cast_sender_; | 598 scoped_ptr<CastSender> cast_sender_; |
| 590 scoped_refptr<FrameInput> frame_input_; | 599 scoped_refptr<AudioFrameInput> audio_frame_input_; |
| 600 scoped_refptr<VideoFrameInput> video_frame_input_; |
| 591 scoped_refptr<FrameReceiver> frame_receiver_; | 601 scoped_refptr<FrameReceiver> frame_receiver_; |
| 592 | 602 |
| 593 scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_; | 603 scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_; |
| 594 scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_; | 604 scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_; |
| 595 | 605 |
| 596 scoped_ptr<TestAudioBusFactory> audio_bus_factory_; | 606 scoped_ptr<TestAudioBusFactory> audio_bus_factory_; |
| 597 | 607 |
| 598 SimpleEventSubscriber event_subscriber_sender_; | 608 SimpleEventSubscriber event_subscriber_sender_; |
| 599 std::vector<FrameEvent> frame_events_; | 609 std::vector<FrameEvent> frame_events_; |
| 600 std::vector<PacketEvent> packet_events_; | 610 std::vector<PacketEvent> packet_events_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 626 // first samples will be 0 and then slowly ramp up to its real | 636 // first samples will be 0 and then slowly ramp up to its real |
| 627 // amplitude; | 637 // amplitude; |
| 628 // ignore the first frame. | 638 // ignore the first frame. |
| 629 test_receiver_audio_callback_->AddExpectedResult( | 639 test_receiver_audio_callback_->AddExpectedResult( |
| 630 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 640 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
| 631 num_10ms_blocks, | 641 num_10ms_blocks, |
| 632 send_time); | 642 send_time); |
| 633 } | 643 } |
| 634 | 644 |
| 635 AudioBus* const audio_bus_ptr = audio_bus.get(); | 645 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 636 frame_input_->InsertAudio( | 646 audio_frame_input_->InsertAudio( |
| 637 audio_bus_ptr, | 647 audio_bus_ptr, |
| 638 send_time, | 648 send_time, |
| 639 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 649 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 640 | 650 |
| 641 test_receiver_video_callback_->AddExpectedResult( | 651 test_receiver_video_callback_->AddExpectedResult( |
| 642 video_start, | 652 video_start, |
| 643 video_sender_config_.width, | 653 video_sender_config_.width, |
| 644 video_sender_config_.height, | 654 video_sender_config_.height, |
| 645 send_time); | 655 send_time); |
| 646 SendVideoFrame(video_start, send_time); | 656 SendVideoFrame(video_start, send_time); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 for (; i < 10; ++i) { | 693 for (; i < 10; ++i) { |
| 684 base::TimeTicks send_time = testing_clock_sender_->NowTicks(); | 694 base::TimeTicks send_time = testing_clock_sender_->NowTicks(); |
| 685 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( | 695 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( |
| 686 base::TimeDelta::FromMilliseconds(10))); | 696 base::TimeDelta::FromMilliseconds(10))); |
| 687 test_receiver_audio_callback_->AddExpectedResult( | 697 test_receiver_audio_callback_->AddExpectedResult( |
| 688 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 698 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
| 689 1, | 699 1, |
| 690 send_time); | 700 send_time); |
| 691 | 701 |
| 692 AudioBus* const audio_bus_ptr = audio_bus.get(); | 702 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 693 frame_input_->InsertAudio( | 703 audio_frame_input_->InsertAudio( |
| 694 audio_bus_ptr, | 704 audio_bus_ptr, |
| 695 send_time, | 705 send_time, |
| 696 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 706 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 697 | 707 |
| 698 RunTasks(10); | 708 RunTasks(10); |
| 699 frame_receiver_->GetCodedAudioFrame( | 709 frame_receiver_->GetCodedAudioFrame( |
| 700 base::Bind(&TestReceiverAudioCallback::CheckCodedPcmAudioFrame, | 710 base::Bind(&TestReceiverAudioCallback::CheckCodedPcmAudioFrame, |
| 701 test_receiver_audio_callback_)); | 711 test_receiver_audio_callback_)); |
| 702 } | 712 } |
| 703 RunTasks(2 * kFrameTimerMs + 1); // Empty the receiver pipeline. | 713 RunTasks(2 * kFrameTimerMs + 1); // Empty the receiver pipeline. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 718 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); | 728 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); |
| 719 | 729 |
| 720 if (i != 0) { | 730 if (i != 0) { |
| 721 test_receiver_audio_callback_->AddExpectedResult( | 731 test_receiver_audio_callback_->AddExpectedResult( |
| 722 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 732 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
| 723 num_10ms_blocks, | 733 num_10ms_blocks, |
| 724 send_time); | 734 send_time); |
| 725 } | 735 } |
| 726 | 736 |
| 727 AudioBus* const audio_bus_ptr = audio_bus.get(); | 737 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 728 frame_input_->InsertAudio( | 738 audio_frame_input_->InsertAudio( |
| 729 audio_bus_ptr, | 739 audio_bus_ptr, |
| 730 send_time, | 740 send_time, |
| 731 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 741 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 732 | 742 |
| 733 RunTasks(30); | 743 RunTasks(30); |
| 734 | 744 |
| 735 if (i == 0) { | 745 if (i == 0) { |
| 736 frame_receiver_->GetRawAudioFrame( | 746 frame_receiver_->GetRawAudioFrame( |
| 737 num_10ms_blocks, | 747 num_10ms_blocks, |
| 738 audio_sender_config_.frequency, | 748 audio_sender_config_.frequency, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 768 int num_10ms_blocks = audio_diff / 10; | 778 int num_10ms_blocks = audio_diff / 10; |
| 769 audio_diff -= num_10ms_blocks * 10; | 779 audio_diff -= num_10ms_blocks * 10; |
| 770 | 780 |
| 771 base::TimeTicks send_time = testing_clock_sender_->NowTicks(); | 781 base::TimeTicks send_time = testing_clock_sender_->NowTicks(); |
| 772 if (initial_send_time.is_null()) | 782 if (initial_send_time.is_null()) |
| 773 initial_send_time = send_time; | 783 initial_send_time = send_time; |
| 774 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( | 784 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( |
| 775 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); | 785 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); |
| 776 | 786 |
| 777 AudioBus* const audio_bus_ptr = audio_bus.get(); | 787 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 778 frame_input_->InsertAudio( | 788 audio_frame_input_->InsertAudio( |
| 779 audio_bus_ptr, | 789 audio_bus_ptr, |
| 780 send_time, | 790 send_time, |
| 781 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 791 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 782 | 792 |
| 783 // Frame will be rendered with 100mS delay, as the transmission is delayed. | 793 // Frame will be rendered with 100mS delay, as the transmission is delayed. |
| 784 // The receiver at this point cannot be synced to the sender's clock, as no | 794 // The receiver at this point cannot be synced to the sender's clock, as no |
| 785 // packets, and specifically no RTCP packets were sent. | 795 // packets, and specifically no RTCP packets were sent. |
| 786 test_receiver_video_callback_->AddExpectedResult( | 796 test_receiver_video_callback_->AddExpectedResult( |
| 787 video_start, | 797 video_start, |
| 788 video_sender_config_.width, | 798 video_sender_config_.width, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 810 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); | 820 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); |
| 811 | 821 |
| 812 if (j >= number_of_audio_frames_to_ignore) { | 822 if (j >= number_of_audio_frames_to_ignore) { |
| 813 test_receiver_audio_callback_->AddExpectedResult( | 823 test_receiver_audio_callback_->AddExpectedResult( |
| 814 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 824 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
| 815 num_10ms_blocks, | 825 num_10ms_blocks, |
| 816 send_time); | 826 send_time); |
| 817 } | 827 } |
| 818 | 828 |
| 819 AudioBus* const audio_bus_ptr = audio_bus.get(); | 829 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 820 frame_input_->InsertAudio( | 830 audio_frame_input_->InsertAudio( |
| 821 audio_bus_ptr, | 831 audio_bus_ptr, |
| 822 send_time, | 832 send_time, |
| 823 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 833 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 824 | 834 |
| 825 test_receiver_video_callback_->AddExpectedResult( | 835 test_receiver_video_callback_->AddExpectedResult( |
| 826 video_start, | 836 video_start, |
| 827 video_sender_config_.width, | 837 video_sender_config_.width, |
| 828 video_sender_config_.height, | 838 video_sender_config_.height, |
| 829 send_time); | 839 send_time); |
| 830 | 840 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 // Due to the re-sampler and NetEq in the webrtc AudioCodingModule the | 1051 // Due to the re-sampler and NetEq in the webrtc AudioCodingModule the |
| 1042 // first samples will be 0 and then slowly ramp up to its real | 1052 // first samples will be 0 and then slowly ramp up to its real |
| 1043 // amplitude; | 1053 // amplitude; |
| 1044 // ignore the first frame. | 1054 // ignore the first frame. |
| 1045 test_receiver_audio_callback_->AddExpectedResult( | 1055 test_receiver_audio_callback_->AddExpectedResult( |
| 1046 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 1056 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
| 1047 num_10ms_blocks, | 1057 num_10ms_blocks, |
| 1048 send_time); | 1058 send_time); |
| 1049 } | 1059 } |
| 1050 AudioBus* const audio_bus_ptr = audio_bus.get(); | 1060 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 1051 frame_input_->InsertAudio( | 1061 audio_frame_input_->InsertAudio( |
| 1052 audio_bus_ptr, | 1062 audio_bus_ptr, |
| 1053 send_time, | 1063 send_time, |
| 1054 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 1064 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 1055 | 1065 |
| 1056 RunTasks(num_10ms_blocks * 10); | 1066 RunTasks(num_10ms_blocks * 10); |
| 1057 | 1067 |
| 1058 if (frames_counter == 0) { | 1068 if (frames_counter == 0) { |
| 1059 frame_receiver_->GetRawAudioFrame( | 1069 frame_receiver_->GetRawAudioFrame( |
| 1060 num_10ms_blocks, | 1070 num_10ms_blocks, |
| 1061 32000, | 1071 32000, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 // first samples will be 0 and then slowly ramp up to its real | 1229 // first samples will be 0 and then slowly ramp up to its real |
| 1220 // amplitude; | 1230 // amplitude; |
| 1221 // ignore the first frame. | 1231 // ignore the first frame. |
| 1222 test_receiver_audio_callback_->AddExpectedResult( | 1232 test_receiver_audio_callback_->AddExpectedResult( |
| 1223 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 1233 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
| 1224 num_10ms_blocks, | 1234 num_10ms_blocks, |
| 1225 send_time); | 1235 send_time); |
| 1226 } | 1236 } |
| 1227 | 1237 |
| 1228 AudioBus* const audio_bus_ptr = audio_bus.get(); | 1238 AudioBus* const audio_bus_ptr = audio_bus.get(); |
| 1229 frame_input_->InsertAudio( | 1239 audio_frame_input_->InsertAudio( |
| 1230 audio_bus_ptr, | 1240 audio_bus_ptr, |
| 1231 send_time, | 1241 send_time, |
| 1232 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 1242 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
| 1233 | 1243 |
| 1234 RunTasks(kFrameTimerMs); | 1244 RunTasks(kFrameTimerMs); |
| 1235 audio_diff += kFrameTimerMs; | 1245 audio_diff += kFrameTimerMs; |
| 1236 | 1246 |
| 1237 if (i == 0) { | 1247 if (i == 0) { |
| 1238 frame_receiver_->GetRawAudioFrame( | 1248 frame_receiver_->GetRawAudioFrame( |
| 1239 num_10ms_blocks, | 1249 num_10ms_blocks, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); | 1331 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); |
| 1322 } | 1332 } |
| 1323 | 1333 |
| 1324 // TODO(pwestin): Add repeatable packet loss test. | 1334 // TODO(pwestin): Add repeatable packet loss test. |
| 1325 // TODO(pwestin): Add test for misaligned send get calls. | 1335 // TODO(pwestin): Add test for misaligned send get calls. |
| 1326 // TODO(pwestin): Add more tests that does not resample. | 1336 // TODO(pwestin): Add more tests that does not resample. |
| 1327 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1337 // TODO(pwestin): Add test when we have starvation for our RunTask. |
| 1328 | 1338 |
| 1329 } // namespace cast | 1339 } // namespace cast |
| 1330 } // namespace media | 1340 } // namespace media |
| OLD | NEW |