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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 task_runner_, | 399 task_runner_, |
400 task_runner_, | 400 task_runner_, |
401 task_runner_, | 401 task_runner_, |
402 task_runner_, | 402 task_runner_, |
403 task_runner_, | 403 task_runner_, |
404 task_runner_, | 404 task_runner_, |
405 GetLoggingConfigWithRawEventsAndStatsEnabled())), | 405 GetLoggingConfigWithRawEventsAndStatsEnabled())), |
406 receiver_to_sender_(cast_environment_), | 406 receiver_to_sender_(cast_environment_), |
407 sender_to_receiver_(cast_environment_), | 407 sender_to_receiver_(cast_environment_), |
408 test_receiver_audio_callback_(new TestReceiverAudioCallback()), | 408 test_receiver_audio_callback_(new TestReceiverAudioCallback()), |
409 test_receiver_video_callback_(new TestReceiverVideoCallback()) { | 409 test_receiver_video_callback_(new TestReceiverVideoCallback()), |
| 410 audio_initialization_cnt_(0), |
| 411 video_initialization_cnt_(0) { |
410 testing_clock_->Advance( | 412 testing_clock_->Advance( |
411 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 413 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
412 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); | 414 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); |
413 } | 415 } |
414 | 416 |
415 void SetupConfig(transport::AudioCodec audio_codec, | 417 void SetupConfig(transport::AudioCodec audio_codec, |
416 int audio_sampling_frequency, | 418 int audio_sampling_frequency, |
417 // TODO(miu): 3rd arg is meaningless?!? | 419 // TODO(miu): 3rd arg is meaningless?!? |
418 bool external_audio_decoder, | 420 bool external_audio_decoder, |
419 int max_number_of_video_buffers_used) { | 421 int max_number_of_video_buffers_used) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 transport_config_.video_ssrc = video_sender_config_.sender_ssrc; | 470 transport_config_.video_ssrc = video_sender_config_.sender_ssrc; |
469 transport_config_.video_codec = video_sender_config_.codec; | 471 transport_config_.video_codec = video_sender_config_.codec; |
470 transport_config_.audio_codec = audio_sender_config_.codec; | 472 transport_config_.audio_codec = audio_sender_config_.codec; |
471 transport_config_.video_rtp_config = video_sender_config_.rtp_config; | 473 transport_config_.video_rtp_config = video_sender_config_.rtp_config; |
472 transport_config_.audio_rtp_config = audio_sender_config_.rtp_config; | 474 transport_config_.audio_rtp_config = audio_sender_config_.rtp_config; |
473 transport_config_.audio_frequency = audio_sender_config_.frequency; | 475 transport_config_.audio_frequency = audio_sender_config_.frequency; |
474 transport_config_.audio_channels = audio_sender_config_.channels; | 476 transport_config_.audio_channels = audio_sender_config_.channels; |
475 } | 477 } |
476 | 478 |
477 void Create() { | 479 void Create() { |
478 cast_receiver_.reset( | 480 cast_receiver_ = CastReceiver::Create(cast_environment_, |
479 CastReceiver::CreateCastReceiver(cast_environment_, | 481 audio_receiver_config_, |
480 audio_receiver_config_, | 482 video_receiver_config_, |
481 video_receiver_config_, | 483 &receiver_to_sender_); |
482 &receiver_to_sender_)); | |
483 transport_sender_.reset(new transport::CastTransportSenderImpl( | 484 transport_sender_.reset(new transport::CastTransportSenderImpl( |
484 testing_clock_, | 485 testing_clock_, |
485 transport_config_, | 486 transport_config_, |
486 base::Bind(&UpdateCastTransportStatus), | 487 base::Bind(&UpdateCastTransportStatus), |
487 task_runner_, | 488 task_runner_, |
488 &sender_to_receiver_)); | 489 &sender_to_receiver_)); |
489 | 490 |
490 cast_sender_.reset(CastSender::CreateCastSender( | 491 cast_sender_ = CastSender::Create( |
491 cast_environment_, | 492 cast_environment_, |
492 &audio_sender_config_, | |
493 &video_sender_config_, | |
494 NULL, | |
495 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)), | 493 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)), |
496 transport_sender_.get())); | 494 transport_sender_.get()); |
| 495 |
| 496 // Initializing audio and video senders. |
| 497 cast_sender_->InitializeAudio(audio_sender_config_); |
| 498 cast_sender_->InitializeVideo(video_sender_config_, NULL); |
497 | 499 |
498 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); | 500 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); |
499 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); | 501 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); |
500 | 502 |
501 frame_input_ = cast_sender_->frame_input(); | 503 audio_frame_input_ = cast_sender_->audio_frame_input(); |
| 504 video_frame_input_ = cast_sender_->video_frame_input(); |
| 505 |
502 frame_receiver_ = cast_receiver_->frame_receiver(); | 506 frame_receiver_ = cast_receiver_->frame_receiver(); |
503 | 507 |
504 audio_bus_factory_.reset( | 508 audio_bus_factory_.reset( |
505 new TestAudioBusFactory(audio_sender_config_.channels, | 509 new TestAudioBusFactory(audio_sender_config_.channels, |
506 audio_sender_config_.frequency, | 510 audio_sender_config_.frequency, |
507 kSoundFrequency, | 511 kSoundFrequency, |
508 kSoundVolume)); | 512 kSoundVolume)); |
509 } | 513 } |
510 | 514 |
511 virtual ~End2EndTest() { | 515 virtual ~End2EndTest() { |
(...skipping 11 matching lines...) Expand all Loading... |
523 if (start_time_.is_null()) | 527 if (start_time_.is_null()) |
524 start_time_ = capture_time; | 528 start_time_ = capture_time; |
525 base::TimeDelta time_diff = capture_time - start_time_; | 529 base::TimeDelta time_diff = capture_time - start_time_; |
526 gfx::Size size(video_sender_config_.width, video_sender_config_.height); | 530 gfx::Size size(video_sender_config_.width, video_sender_config_.height); |
527 EXPECT_TRUE(VideoFrame::IsValidConfig( | 531 EXPECT_TRUE(VideoFrame::IsValidConfig( |
528 VideoFrame::I420, size, gfx::Rect(size), size)); | 532 VideoFrame::I420, size, gfx::Rect(size), size)); |
529 scoped_refptr<media::VideoFrame> video_frame = | 533 scoped_refptr<media::VideoFrame> video_frame = |
530 media::VideoFrame::CreateFrame( | 534 media::VideoFrame::CreateFrame( |
531 VideoFrame::I420, size, gfx::Rect(size), size, time_diff); | 535 VideoFrame::I420, size, gfx::Rect(size), size, time_diff); |
532 PopulateVideoFrame(video_frame, start_value); | 536 PopulateVideoFrame(video_frame, start_value); |
533 frame_input_->InsertRawVideoFrame(video_frame, capture_time); | 537 video_frame_input_->InsertRawVideoFrame(video_frame, capture_time); |
534 } | 538 } |
535 | 539 |
536 void RunTasks(int during_ms) { | 540 void RunTasks(int during_ms) { |
537 for (int i = 0; i < during_ms; ++i) { | 541 for (int i = 0; i < during_ms; ++i) { |
538 // Call process the timers every 1 ms. | 542 // Call process the timers every 1 ms. |
539 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); | 543 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); |
540 task_runner_->RunTasks(); | 544 task_runner_->RunTasks(); |
541 } | 545 } |
542 } | 546 } |
543 | 547 |
544 void InitializationResult(CastInitializationStatus result) { | 548 void InitializationResult(CastInitializationStatus result) { |
545 EXPECT_EQ(result, STATUS_INITIALIZED); | 549 // Result should be STATUS_AUDIO_INITIALIZED or STATUS_VIDEO_INITIALIZED; |
| 550 // each should be called only once. |
| 551 if (result == STATUS_AUDIO_INITIALIZED) { |
| 552 ++audio_initialization_cnt_; |
| 553 } else if (result == STATUS_VIDEO_INITIALIZED) { |
| 554 ++video_initialization_cnt_; |
| 555 } else { |
| 556 FAIL(); |
| 557 } |
| 558 EXPECT_GE(1, audio_initialization_cnt_); |
| 559 EXPECT_GE(1, video_initialization_cnt_); |
546 } | 560 } |
547 | 561 |
548 AudioReceiverConfig audio_receiver_config_; | 562 AudioReceiverConfig audio_receiver_config_; |
549 VideoReceiverConfig video_receiver_config_; | 563 VideoReceiverConfig video_receiver_config_; |
550 AudioSenderConfig audio_sender_config_; | 564 AudioSenderConfig audio_sender_config_; |
551 VideoSenderConfig video_sender_config_; | 565 VideoSenderConfig video_sender_config_; |
552 transport::CastTransportConfig transport_config_; | 566 transport::CastTransportConfig transport_config_; |
553 | 567 |
554 base::TimeTicks start_time_; | 568 base::TimeTicks start_time_; |
555 base::SimpleTestTickClock* testing_clock_; | 569 base::SimpleTestTickClock* testing_clock_; |
556 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 570 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
557 scoped_refptr<CastEnvironment> cast_environment_; | 571 scoped_refptr<CastEnvironment> cast_environment_; |
558 | 572 |
559 LoopBackTransport receiver_to_sender_; | 573 LoopBackTransport receiver_to_sender_; |
560 LoopBackTransport sender_to_receiver_; | 574 LoopBackTransport sender_to_receiver_; |
561 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; | 575 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; |
562 | 576 |
563 scoped_ptr<CastReceiver> cast_receiver_; | 577 scoped_ptr<CastReceiver> cast_receiver_; |
564 scoped_ptr<CastSender> cast_sender_; | 578 scoped_ptr<CastSender> cast_sender_; |
565 scoped_refptr<FrameInput> frame_input_; | 579 scoped_refptr<AudioFrameInput> audio_frame_input_; |
| 580 scoped_refptr<VideoFrameInput> video_frame_input_; |
566 scoped_refptr<FrameReceiver> frame_receiver_; | 581 scoped_refptr<FrameReceiver> frame_receiver_; |
567 | 582 |
568 scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_; | 583 scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_; |
569 scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_; | 584 scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_; |
570 | 585 |
571 scoped_ptr<TestAudioBusFactory> audio_bus_factory_; | 586 scoped_ptr<TestAudioBusFactory> audio_bus_factory_; |
572 | 587 |
573 SimpleEventSubscriber event_subscriber_; | 588 SimpleEventSubscriber event_subscriber_; |
574 std::vector<FrameEvent> frame_events_; | 589 std::vector<FrameEvent> frame_events_; |
575 std::vector<PacketEvent> packet_events_; | 590 std::vector<PacketEvent> packet_events_; |
576 std::vector<GenericEvent> generic_events_; | 591 std::vector<GenericEvent> generic_events_; |
| 592 int audio_initialization_cnt_; |
| 593 int video_initialization_cnt_; |
577 }; | 594 }; |
578 | 595 |
579 #if defined(OS_WIN) | 596 #if defined(OS_WIN) |
580 #define MAYBE_LoopNoLossPcm16 DISABLED_LoopNoLossPcm16 | 597 #define MAYBE_LoopNoLossPcm16 DISABLED_LoopNoLossPcm16 |
581 #else | 598 #else |
582 #define MAYBE_LoopNoLossPcm16 LoopNoLossPcm16 | 599 #define MAYBE_LoopNoLossPcm16 LoopNoLossPcm16 |
583 #endif | 600 #endif |
584 // TODO(mikhal): Crashes in win bots (http://crbug.com/329563) | 601 // TODO(mikhal): Crashes in win bots (http://crbug.com/329563) |
585 TEST_F(End2EndTest, MAYBE_LoopNoLossPcm16) { | 602 TEST_F(End2EndTest, MAYBE_LoopNoLossPcm16) { |
586 SetupConfig(transport::kPcm16, 32000, false, 1); | 603 SetupConfig(transport::kPcm16, 32000, false, 1); |
(...skipping 20 matching lines...) Expand all Loading... |
607 // first samples will be 0 and then slowly ramp up to its real | 624 // first samples will be 0 and then slowly ramp up to its real |
608 // amplitude; | 625 // amplitude; |
609 // ignore the first frame. | 626 // ignore the first frame. |
610 test_receiver_audio_callback_->AddExpectedResult( | 627 test_receiver_audio_callback_->AddExpectedResult( |
611 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 628 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
612 num_10ms_blocks, | 629 num_10ms_blocks, |
613 send_time); | 630 send_time); |
614 } | 631 } |
615 | 632 |
616 AudioBus* const audio_bus_ptr = audio_bus.get(); | 633 AudioBus* const audio_bus_ptr = audio_bus.get(); |
617 frame_input_->InsertAudio( | 634 audio_frame_input_->InsertAudio( |
618 audio_bus_ptr, | 635 audio_bus_ptr, |
619 send_time, | 636 send_time, |
620 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 637 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
621 | 638 |
622 test_receiver_video_callback_->AddExpectedResult( | 639 test_receiver_video_callback_->AddExpectedResult( |
623 video_start, | 640 video_start, |
624 video_sender_config_.width, | 641 video_sender_config_.width, |
625 video_sender_config_.height, | 642 video_sender_config_.height, |
626 send_time); | 643 send_time); |
627 SendVideoFrame(video_start, send_time); | 644 SendVideoFrame(video_start, send_time); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 for (; i < 10; ++i) { | 689 for (; i < 10; ++i) { |
673 base::TimeTicks send_time = testing_clock_->NowTicks(); | 690 base::TimeTicks send_time = testing_clock_->NowTicks(); |
674 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( | 691 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( |
675 base::TimeDelta::FromMilliseconds(10))); | 692 base::TimeDelta::FromMilliseconds(10))); |
676 test_receiver_audio_callback_->AddExpectedResult( | 693 test_receiver_audio_callback_->AddExpectedResult( |
677 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 694 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
678 1, | 695 1, |
679 send_time); | 696 send_time); |
680 | 697 |
681 AudioBus* const audio_bus_ptr = audio_bus.get(); | 698 AudioBus* const audio_bus_ptr = audio_bus.get(); |
682 frame_input_->InsertAudio( | 699 audio_frame_input_->InsertAudio( |
683 audio_bus_ptr, | 700 audio_bus_ptr, |
684 send_time, | 701 send_time, |
685 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 702 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
686 | 703 |
687 RunTasks(10); | 704 RunTasks(10); |
688 frame_receiver_->GetCodedAudioFrame( | 705 frame_receiver_->GetCodedAudioFrame( |
689 base::Bind(&TestReceiverAudioCallback::CheckCodedPcmAudioFrame, | 706 base::Bind(&TestReceiverAudioCallback::CheckCodedPcmAudioFrame, |
690 test_receiver_audio_callback_)); | 707 test_receiver_audio_callback_)); |
691 } | 708 } |
692 RunTasks(2 * kFrameTimerMs + 1); // Empty the receiver pipeline. | 709 RunTasks(2 * kFrameTimerMs + 1); // Empty the receiver pipeline. |
(...skipping 20 matching lines...) Expand all Loading... |
713 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); | 730 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); |
714 | 731 |
715 if (i != 0) { | 732 if (i != 0) { |
716 test_receiver_audio_callback_->AddExpectedResult( | 733 test_receiver_audio_callback_->AddExpectedResult( |
717 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 734 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
718 num_10ms_blocks, | 735 num_10ms_blocks, |
719 send_time); | 736 send_time); |
720 } | 737 } |
721 | 738 |
722 AudioBus* const audio_bus_ptr = audio_bus.get(); | 739 AudioBus* const audio_bus_ptr = audio_bus.get(); |
723 frame_input_->InsertAudio( | 740 audio_frame_input_->InsertAudio( |
724 audio_bus_ptr, | 741 audio_bus_ptr, |
725 send_time, | 742 send_time, |
726 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 743 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
727 | 744 |
728 RunTasks(30); | 745 RunTasks(30); |
729 | 746 |
730 if (i == 0) { | 747 if (i == 0) { |
731 frame_receiver_->GetRawAudioFrame( | 748 frame_receiver_->GetRawAudioFrame( |
732 num_10ms_blocks, | 749 num_10ms_blocks, |
733 audio_sender_config_.frequency, | 750 audio_sender_config_.frequency, |
(...skipping 26 matching lines...) Expand all Loading... |
760 | 777 |
761 for (int i = 0; i < 3; ++i) { | 778 for (int i = 0; i < 3; ++i) { |
762 int num_10ms_blocks = audio_diff / 10; | 779 int num_10ms_blocks = audio_diff / 10; |
763 audio_diff -= num_10ms_blocks * 10; | 780 audio_diff -= num_10ms_blocks * 10; |
764 | 781 |
765 base::TimeTicks send_time = testing_clock_->NowTicks(); | 782 base::TimeTicks send_time = testing_clock_->NowTicks(); |
766 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( | 783 scoped_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus( |
767 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); | 784 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); |
768 | 785 |
769 AudioBus* const audio_bus_ptr = audio_bus.get(); | 786 AudioBus* const audio_bus_ptr = audio_bus.get(); |
770 frame_input_->InsertAudio( | 787 audio_frame_input_->InsertAudio( |
771 audio_bus_ptr, | 788 audio_bus_ptr, |
772 send_time, | 789 send_time, |
773 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 790 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
774 | 791 |
775 SendVideoFrame(video_start, send_time); | 792 SendVideoFrame(video_start, send_time); |
776 RunTasks(kFrameTimerMs); | 793 RunTasks(kFrameTimerMs); |
777 audio_diff += kFrameTimerMs; | 794 audio_diff += kFrameTimerMs; |
778 video_start++; | 795 video_start++; |
779 } | 796 } |
780 RunTasks(100); | 797 RunTasks(100); |
(...skipping 10 matching lines...) Expand all Loading... |
791 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); | 808 base::TimeDelta::FromMilliseconds(10) * num_10ms_blocks)); |
792 | 809 |
793 if (j >= number_of_audio_frames_to_ignore) { | 810 if (j >= number_of_audio_frames_to_ignore) { |
794 test_receiver_audio_callback_->AddExpectedResult( | 811 test_receiver_audio_callback_->AddExpectedResult( |
795 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 812 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
796 num_10ms_blocks, | 813 num_10ms_blocks, |
797 send_time); | 814 send_time); |
798 } | 815 } |
799 | 816 |
800 AudioBus* const audio_bus_ptr = audio_bus.get(); | 817 AudioBus* const audio_bus_ptr = audio_bus.get(); |
801 frame_input_->InsertAudio( | 818 audio_frame_input_->InsertAudio( |
802 audio_bus_ptr, | 819 audio_bus_ptr, |
803 send_time, | 820 send_time, |
804 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 821 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
805 | 822 |
806 test_receiver_video_callback_->AddExpectedResult( | 823 test_receiver_video_callback_->AddExpectedResult( |
807 video_start, | 824 video_start, |
808 video_sender_config_.width, | 825 video_sender_config_.width, |
809 video_sender_config_.height, | 826 video_sender_config_.height, |
810 send_time); | 827 send_time); |
811 | 828 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 // Due to the re-sampler and NetEq in the webrtc AudioCodingModule the | 1045 // Due to the re-sampler and NetEq in the webrtc AudioCodingModule the |
1029 // first samples will be 0 and then slowly ramp up to its real | 1046 // first samples will be 0 and then slowly ramp up to its real |
1030 // amplitude; | 1047 // amplitude; |
1031 // ignore the first frame. | 1048 // ignore the first frame. |
1032 test_receiver_audio_callback_->AddExpectedResult( | 1049 test_receiver_audio_callback_->AddExpectedResult( |
1033 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 1050 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
1034 num_10ms_blocks, | 1051 num_10ms_blocks, |
1035 send_time); | 1052 send_time); |
1036 } | 1053 } |
1037 AudioBus* const audio_bus_ptr = audio_bus.get(); | 1054 AudioBus* const audio_bus_ptr = audio_bus.get(); |
1038 frame_input_->InsertAudio( | 1055 audio_frame_input_->InsertAudio( |
1039 audio_bus_ptr, | 1056 audio_bus_ptr, |
1040 send_time, | 1057 send_time, |
1041 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 1058 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
1042 | 1059 |
1043 RunTasks(num_10ms_blocks * 10); | 1060 RunTasks(num_10ms_blocks * 10); |
1044 | 1061 |
1045 if (frames_counter == 0) { | 1062 if (frames_counter == 0) { |
1046 frame_receiver_->GetRawAudioFrame( | 1063 frame_receiver_->GetRawAudioFrame( |
1047 num_10ms_blocks, | 1064 num_10ms_blocks, |
1048 32000, | 1065 32000, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 // first samples will be 0 and then slowly ramp up to its real | 1216 // first samples will be 0 and then slowly ramp up to its real |
1200 // amplitude; | 1217 // amplitude; |
1201 // ignore the first frame. | 1218 // ignore the first frame. |
1202 test_receiver_audio_callback_->AddExpectedResult( | 1219 test_receiver_audio_callback_->AddExpectedResult( |
1203 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), | 1220 ToPcmAudioFrame(*audio_bus, audio_sender_config_.frequency), |
1204 num_10ms_blocks, | 1221 num_10ms_blocks, |
1205 send_time); | 1222 send_time); |
1206 } | 1223 } |
1207 | 1224 |
1208 AudioBus* const audio_bus_ptr = audio_bus.get(); | 1225 AudioBus* const audio_bus_ptr = audio_bus.get(); |
1209 frame_input_->InsertAudio( | 1226 audio_frame_input_->InsertAudio( |
1210 audio_bus_ptr, | 1227 audio_bus_ptr, |
1211 send_time, | 1228 send_time, |
1212 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); | 1229 base::Bind(&OwnThatAudioBus, base::Passed(&audio_bus))); |
1213 | 1230 |
1214 RunTasks(kFrameTimerMs); | 1231 RunTasks(kFrameTimerMs); |
1215 audio_diff += kFrameTimerMs; | 1232 audio_diff += kFrameTimerMs; |
1216 | 1233 |
1217 if (i == 0) { | 1234 if (i == 0) { |
1218 frame_receiver_->GetRawAudioFrame( | 1235 frame_receiver_->GetRawAudioFrame( |
1219 num_10ms_blocks, | 1236 num_10ms_blocks, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); | 1301 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); |
1285 } | 1302 } |
1286 | 1303 |
1287 // TODO(pwestin): Add repeatable packet loss test. | 1304 // TODO(pwestin): Add repeatable packet loss test. |
1288 // TODO(pwestin): Add test for misaligned send get calls. | 1305 // TODO(pwestin): Add test for misaligned send get calls. |
1289 // TODO(pwestin): Add more tests that does not resample. | 1306 // TODO(pwestin): Add more tests that does not resample. |
1290 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1307 // TODO(pwestin): Add test when we have starvation for our RunTask. |
1291 | 1308 |
1292 } // namespace cast | 1309 } // namespace cast |
1293 } // namespace media | 1310 } // namespace media |
OLD | NEW |