Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 audio_receiver_config_, | 482 audio_receiver_config_, |
| 481 video_receiver_config_, | 483 video_receiver_config_, |
| 482 &receiver_to_sender_)); | 484 &receiver_to_sender_)); |
| 483 transport_sender_.reset(new transport::CastTransportSenderImpl( | 485 transport_sender_.reset(new transport::CastTransportSenderImpl( |
| 484 testing_clock_, | 486 testing_clock_, |
| 485 transport_config_, | 487 transport_config_, |
| 486 base::Bind(&UpdateCastTransportStatus), | 488 base::Bind(&UpdateCastTransportStatus), |
| 487 task_runner_, | 489 task_runner_, |
| 488 &sender_to_receiver_)); | 490 &sender_to_receiver_)); |
| 489 | 491 |
| 490 cast_sender_.reset(CastSender::CreateCastSender( | 492 cast_sender_.reset(CastSender::Create( |
| 491 cast_environment_, | 493 cast_environment_, |
| 492 &audio_sender_config_, | |
| 493 &video_sender_config_, | |
| 494 NULL, | |
| 495 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)), | 494 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)), |
| 496 transport_sender_.get())); | 495 transport_sender_.get())); |
| 497 | 496 |
| 497 // Initializing audio and video senders. | |
| 498 cast_sender_->InitializeAudio(audio_sender_config_); | |
| 499 cast_sender_->InitializeVideo(video_sender_config_, NULL); | |
| 500 | |
| 498 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); | 501 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); |
| 499 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); | 502 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); |
| 500 | 503 |
| 501 frame_input_ = cast_sender_->frame_input(); | 504 frame_input_ = cast_sender_->frame_input(); |
| 502 frame_receiver_ = cast_receiver_->frame_receiver(); | 505 frame_receiver_ = cast_receiver_->frame_receiver(); |
| 503 | 506 |
| 504 audio_bus_factory_.reset( | 507 audio_bus_factory_.reset( |
| 505 new TestAudioBusFactory(audio_sender_config_.channels, | 508 new TestAudioBusFactory(audio_sender_config_.channels, |
| 506 audio_sender_config_.frequency, | 509 audio_sender_config_.frequency, |
| 507 kSoundFrequency, | 510 kSoundFrequency, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 535 | 538 |
| 536 void RunTasks(int during_ms) { | 539 void RunTasks(int during_ms) { |
| 537 for (int i = 0; i < during_ms; ++i) { | 540 for (int i = 0; i < during_ms; ++i) { |
| 538 // Call process the timers every 1 ms. | 541 // Call process the timers every 1 ms. |
| 539 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); | 542 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); |
| 540 task_runner_->RunTasks(); | 543 task_runner_->RunTasks(); |
| 541 } | 544 } |
| 542 } | 545 } |
| 543 | 546 |
| 544 void InitializationResult(CastInitializationStatus result) { | 547 void InitializationResult(CastInitializationStatus result) { |
| 545 EXPECT_EQ(result, STATUS_INITIALIZED); | 548 // Result should be STATUS_AUDIO_INITIALIZED or STATUS_VIDEO_INITIALIZED; |
| 549 // each should be called only once. | |
| 550 if (result == STATUS_AUDIO_INITIALIZED) { | |
| 551 ++audio_initialization_cnt_; | |
| 552 } else if (result == STATUS_VIDEO_INITIALIZED) { | |
| 553 ++video_initialization_cnt_; | |
| 554 } else { | |
| 555 ASSERT_TRUE(false); | |
|
Ami GONE FROM CHROMIUM
2014/02/14 18:23:54
FAIL()
mikhal1
2014/02/18 19:20:43
Done.
| |
| 556 } | |
| 557 EXPECT_GE(1, audio_initialization_cnt_); | |
| 558 EXPECT_GE(1, video_initialization_cnt_); | |
|
Ami GONE FROM CHROMIUM
2014/02/14 18:23:54
s/GE/EQ/ here and on the previous line?
mikhal1
2014/02/18 19:20:43
Don't get the comment. Each can be either 0 or 1,
| |
| 546 } | 559 } |
| 547 | 560 |
| 548 AudioReceiverConfig audio_receiver_config_; | 561 AudioReceiverConfig audio_receiver_config_; |
| 549 VideoReceiverConfig video_receiver_config_; | 562 VideoReceiverConfig video_receiver_config_; |
| 550 AudioSenderConfig audio_sender_config_; | 563 AudioSenderConfig audio_sender_config_; |
| 551 VideoSenderConfig video_sender_config_; | 564 VideoSenderConfig video_sender_config_; |
| 552 transport::CastTransportConfig transport_config_; | 565 transport::CastTransportConfig transport_config_; |
| 553 | 566 |
| 554 base::TimeTicks start_time_; | 567 base::TimeTicks start_time_; |
| 555 base::SimpleTestTickClock* testing_clock_; | 568 base::SimpleTestTickClock* testing_clock_; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 567 | 580 |
| 568 scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_; | 581 scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_; |
| 569 scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_; | 582 scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_; |
| 570 | 583 |
| 571 scoped_ptr<TestAudioBusFactory> audio_bus_factory_; | 584 scoped_ptr<TestAudioBusFactory> audio_bus_factory_; |
| 572 | 585 |
| 573 SimpleEventSubscriber event_subscriber_; | 586 SimpleEventSubscriber event_subscriber_; |
| 574 std::vector<FrameEvent> frame_events_; | 587 std::vector<FrameEvent> frame_events_; |
| 575 std::vector<PacketEvent> packet_events_; | 588 std::vector<PacketEvent> packet_events_; |
| 576 std::vector<GenericEvent> generic_events_; | 589 std::vector<GenericEvent> generic_events_; |
| 590 int audio_initialization_cnt_; | |
| 591 int video_initialization_cnt_; | |
| 577 }; | 592 }; |
| 578 | 593 |
| 579 #if defined(OS_WIN) | 594 #if defined(OS_WIN) |
| 580 #define MAYBE_LoopNoLossPcm16 DISABLED_LoopNoLossPcm16 | 595 #define MAYBE_LoopNoLossPcm16 DISABLED_LoopNoLossPcm16 |
| 581 #else | 596 #else |
| 582 #define MAYBE_LoopNoLossPcm16 LoopNoLossPcm16 | 597 #define MAYBE_LoopNoLossPcm16 LoopNoLossPcm16 |
| 583 #endif | 598 #endif |
| 584 // TODO(mikhal): Crashes in win bots (http://crbug.com/329563) | 599 // TODO(mikhal): Crashes in win bots (http://crbug.com/329563) |
| 585 TEST_F(End2EndTest, MAYBE_LoopNoLossPcm16) { | 600 TEST_F(End2EndTest, MAYBE_LoopNoLossPcm16) { |
| 586 SetupConfig(transport::kPcm16, 32000, false, 1); | 601 SetupConfig(transport::kPcm16, 32000, false, 1); |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); | 1299 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); |
| 1285 } | 1300 } |
| 1286 | 1301 |
| 1287 // TODO(pwestin): Add repeatable packet loss test. | 1302 // TODO(pwestin): Add repeatable packet loss test. |
| 1288 // TODO(pwestin): Add test for misaligned send get calls. | 1303 // TODO(pwestin): Add test for misaligned send get calls. |
| 1289 // TODO(pwestin): Add more tests that does not resample. | 1304 // TODO(pwestin): Add more tests that does not resample. |
| 1290 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1305 // TODO(pwestin): Add test when we have starvation for our RunTask. |
| 1291 | 1306 |
| 1292 } // namespace cast | 1307 } // namespace cast |
| 1293 } // namespace media | 1308 } // namespace media |
| OLD | NEW |