OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <vector> | 5 #include <vector> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 video_frame_factory_ = video_encoder_->CreateVideoFrameFactory().Pass(); | 212 video_frame_factory_ = video_encoder_->CreateVideoFrameFactory().Pass(); |
213 } | 213 } |
214 | 214 |
215 // Checks that |encoded_frame| matches expected values. This is the method | 215 // Checks that |encoded_frame| matches expected values. This is the method |
216 // bound in the callback returned from EncodeAndCheckDelivery(). | 216 // bound in the callback returned from EncodeAndCheckDelivery(). |
217 void DeliverEncodedVideoFrame( | 217 void DeliverEncodedVideoFrame( |
218 uint32 expected_frame_id, | 218 uint32 expected_frame_id, |
219 uint32 expected_last_referenced_frame_id, | 219 uint32 expected_last_referenced_frame_id, |
220 uint32 expected_rtp_timestamp, | 220 uint32 expected_rtp_timestamp, |
221 const base::TimeTicks& expected_reference_time, | 221 const base::TimeTicks& expected_reference_time, |
222 scoped_ptr<SenderEncodedFrame> encoded_frame) { | 222 scoped_ptr<EncodedFrame> encoded_frame) { |
223 EXPECT_TRUE(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 223 EXPECT_TRUE(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
224 | 224 |
225 EXPECT_EQ(expected_frame_id, encoded_frame->frame_id); | 225 EXPECT_EQ(expected_frame_id, encoded_frame->frame_id); |
226 EXPECT_EQ(expected_rtp_timestamp, encoded_frame->rtp_timestamp); | 226 EXPECT_EQ(expected_rtp_timestamp, encoded_frame->rtp_timestamp); |
227 EXPECT_EQ(expected_reference_time, encoded_frame->reference_time); | 227 EXPECT_EQ(expected_reference_time, encoded_frame->reference_time); |
228 | 228 |
229 // The platform encoders are "black boxes" and may choose to vend key frames | 229 // The platform encoders are "black boxes" and may choose to vend key frames |
230 // and/or empty data at any time. The software encoders, however, should | 230 // and/or empty data at any time. The software encoders, however, should |
231 // strictly adhere to expected behavior. | 231 // strictly adhere to expected behavior. |
232 if (is_testing_platform_encoder()) { | 232 if (is_testing_platform_encoder()) { |
(...skipping 13 matching lines...) Expand all Loading... |
246 << encoded_frame->frame_id; | 246 << encoded_frame->frame_id; |
247 } else { | 247 } else { |
248 if (expected_frame_id != expected_last_referenced_frame_id) { | 248 if (expected_frame_id != expected_last_referenced_frame_id) { |
249 EXPECT_EQ(EncodedFrame::DEPENDENT, encoded_frame->dependency); | 249 EXPECT_EQ(EncodedFrame::DEPENDENT, encoded_frame->dependency); |
250 } else if (video_config_.max_number_of_video_buffers_used == 1) { | 250 } else if (video_config_.max_number_of_video_buffers_used == 1) { |
251 EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency); | 251 EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency); |
252 } | 252 } |
253 EXPECT_EQ(expected_last_referenced_frame_id, | 253 EXPECT_EQ(expected_last_referenced_frame_id, |
254 encoded_frame->referenced_frame_id); | 254 encoded_frame->referenced_frame_id); |
255 EXPECT_FALSE(encoded_frame->data.empty()); | 255 EXPECT_FALSE(encoded_frame->data.empty()); |
256 ASSERT_TRUE(std::isfinite(encoded_frame->deadline_utilization)); | |
257 EXPECT_LE(0.0, encoded_frame->deadline_utilization); | |
258 ASSERT_TRUE(std::isfinite(encoded_frame->lossy_utilization)); | |
259 EXPECT_LE(0.0, encoded_frame->lossy_utilization); | |
260 } | 256 } |
261 | 257 |
262 ++count_frames_delivered_; | 258 ++count_frames_delivered_; |
263 } | 259 } |
264 | 260 |
265 base::SimpleTestTickClock* const testing_clock_; // Owned by CastEnvironment. | 261 base::SimpleTestTickClock* const testing_clock_; // Owned by CastEnvironment. |
266 const scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 262 const scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
267 const scoped_refptr<CastEnvironment> cast_environment_; | 263 const scoped_refptr<CastEnvironment> cast_environment_; |
268 VideoSenderConfig video_config_; | 264 VideoSenderConfig video_config_; |
269 scoped_ptr<FakeVideoEncodeAcceleratorFactory> vea_factory_; | 265 scoped_ptr<FakeVideoEncodeAcceleratorFactory> vea_factory_; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 #endif | 448 #endif |
453 return values; | 449 return values; |
454 } | 450 } |
455 } // namespace | 451 } // namespace |
456 | 452 |
457 INSTANTIATE_TEST_CASE_P( | 453 INSTANTIATE_TEST_CASE_P( |
458 , VideoEncoderTest, ::testing::ValuesIn(DetermineEncodersToTest())); | 454 , VideoEncoderTest, ::testing::ValuesIn(DetermineEncodersToTest())); |
459 | 455 |
460 } // namespace cast | 456 } // namespace cast |
461 } // namespace media | 457 } // namespace media |
OLD | NEW |