| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 compressed.assign(reinterpret_cast<const char*>(&v[0]), v.size()); | 96 compressed.assign(reinterpret_cast<const char*>(&v[0]), v.size()); |
| 97 return compressed; | 97 return compressed; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void UpdateCastTransportStatus(CastTransportStatus status) { | 100 void UpdateCastTransportStatus(CastTransportStatus status) { |
| 101 bool result = (status == TRANSPORT_AUDIO_INITIALIZED || | 101 bool result = (status == TRANSPORT_AUDIO_INITIALIZED || |
| 102 status == TRANSPORT_VIDEO_INITIALIZED); | 102 status == TRANSPORT_VIDEO_INITIALIZED); |
| 103 EXPECT_TRUE(result); | 103 EXPECT_TRUE(result); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void AudioInitializationStatus(CastInitializationStatus status) { | 106 void ExpectSuccessOperationalStatus(OperationalStatus status) { |
| 107 EXPECT_EQ(STATUS_AUDIO_INITIALIZED, status); | 107 EXPECT_EQ(STATUS_INITIALIZED, status); |
| 108 } | |
| 109 | |
| 110 void VideoInitializationStatus(CastInitializationStatus status) { | |
| 111 EXPECT_EQ(STATUS_VIDEO_INITIALIZED, status); | |
| 112 } | 108 } |
| 113 | 109 |
| 114 // This is wrapped in a struct because it needs to be put into a std::map. | 110 // This is wrapped in a struct because it needs to be put into a std::map. |
| 115 typedef struct { | 111 typedef struct { |
| 116 int counter[kNumOfLoggingEvents+1]; | 112 int counter[kNumOfLoggingEvents+1]; |
| 117 } LoggingEventCounts; | 113 } LoggingEventCounts; |
| 118 | 114 |
| 119 // Constructs a map from each frame (RTP timestamp) to counts of each event | 115 // Constructs a map from each frame (RTP timestamp) to counts of each event |
| 120 // type logged for that frame. | 116 // type logged for that frame. |
| 121 std::map<RtpTimestamp, LoggingEventCounts> GetEventCountForFrameEvents( | 117 std::map<RtpTimestamp, LoggingEventCounts> GetEventCountForFrameEvents( |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 613 |
| 618 cast_receiver_ = CastReceiver::Create(cast_environment_receiver_, | 614 cast_receiver_ = CastReceiver::Create(cast_environment_receiver_, |
| 619 audio_receiver_config_, | 615 audio_receiver_config_, |
| 620 video_receiver_config_, | 616 video_receiver_config_, |
| 621 transport_receiver_.get()); | 617 transport_receiver_.get()); |
| 622 | 618 |
| 623 cast_sender_ = | 619 cast_sender_ = |
| 624 CastSender::Create(cast_environment_sender_, transport_sender_.get()); | 620 CastSender::Create(cast_environment_sender_, transport_sender_.get()); |
| 625 | 621 |
| 626 // Initializing audio and video senders. | 622 // Initializing audio and video senders. |
| 627 cast_sender_->InitializeAudio(audio_sender_config_, | 623 cast_sender_->InitializeAudio( |
| 628 base::Bind(&AudioInitializationStatus)); | 624 audio_sender_config_, |
| 629 cast_sender_->InitializeVideo(video_sender_config_, | 625 base::Bind(&ExpectSuccessOperationalStatus)); |
| 630 base::Bind(&VideoInitializationStatus), | 626 cast_sender_->InitializeVideo( |
| 631 CreateDefaultVideoEncodeAcceleratorCallback(), | 627 video_sender_config_, |
| 632 CreateDefaultVideoEncodeMemoryCallback()); | 628 base::Bind(&ExpectSuccessOperationalStatus), |
| 629 CreateDefaultVideoEncodeAcceleratorCallback(), |
| 630 CreateDefaultVideoEncodeMemoryCallback()); |
| 633 task_runner_->RunTasks(); | 631 task_runner_->RunTasks(); |
| 634 | 632 |
| 635 receiver_to_sender_.SetPacketReceiver( | 633 receiver_to_sender_.SetPacketReceiver( |
| 636 transport_sender_->PacketReceiverForTesting(), | 634 transport_sender_->PacketReceiverForTesting(), |
| 637 task_runner_, | 635 task_runner_, |
| 638 &testing_clock_); | 636 &testing_clock_); |
| 639 sender_to_receiver_.SetPacketReceiver( | 637 sender_to_receiver_.SetPacketReceiver( |
| 640 transport_receiver_->PacketReceiverForTesting(), | 638 transport_receiver_->PacketReceiverForTesting(), |
| 641 task_runner_, | 639 task_runner_, |
| 642 &testing_clock_); | 640 &testing_clock_); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 EXPECT_LT(jump, 220u); | 1539 EXPECT_LT(jump, 220u); |
| 1542 } | 1540 } |
| 1543 | 1541 |
| 1544 // TODO(pwestin): Add repeatable packet loss test. | 1542 // TODO(pwestin): Add repeatable packet loss test. |
| 1545 // TODO(pwestin): Add test for misaligned send get calls. | 1543 // TODO(pwestin): Add test for misaligned send get calls. |
| 1546 // TODO(pwestin): Add more tests that does not resample. | 1544 // TODO(pwestin): Add more tests that does not resample. |
| 1547 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1545 // TODO(pwestin): Add test when we have starvation for our RunTask. |
| 1548 | 1546 |
| 1549 } // namespace cast | 1547 } // namespace cast |
| 1550 } // namespace media | 1548 } // namespace media |
| OLD | NEW |