| OLD | NEW |
| 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 2 * | 2 * |
| 3 * Use of this source code is governed by a BSD-style license | 3 * Use of this source code is governed by a BSD-style license |
| 4 * that can be found in the LICENSE file in the root of the source | 4 * that can be found in the LICENSE file in the root of the source |
| 5 * tree. An additional intellectual property rights grant can be found | 5 * tree. An additional intellectual property rights grant can be found |
| 6 * in the file PATENTS. All contributing project authors may | 6 * in the file PATENTS. All contributing project authors may |
| 7 * be found in the AUTHORS file in the root of the source tree. | 7 * be found in the AUTHORS file in the root of the source tree. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include <string.h> | 10 #include <string.h> |
| 11 | 11 |
| 12 #include <list> | 12 #include <list> |
| 13 #include <memory> |
| 13 #include <queue> | 14 #include <queue> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 18 #include "webrtc/modules/video_coding/encoded_frame.h" | 19 #include "webrtc/modules/video_coding/encoded_frame.h" |
| 19 #include "webrtc/modules/video_coding/packet.h" | 20 #include "webrtc/modules/video_coding/packet.h" |
| 20 #include "webrtc/modules/video_coding/receiver.h" | 21 #include "webrtc/modules/video_coding/receiver.h" |
| 21 #include "webrtc/modules/video_coding/test/stream_generator.h" | 22 #include "webrtc/modules/video_coding/test/stream_generator.h" |
| 22 #include "webrtc/modules/video_coding/timing.h" | 23 #include "webrtc/modules/video_coding/timing.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 bool DecodeNextFrame() { | 78 bool DecodeNextFrame() { |
| 78 int64_t render_time_ms = 0; | 79 int64_t render_time_ms = 0; |
| 79 VCMEncodedFrame* frame = | 80 VCMEncodedFrame* frame = |
| 80 receiver_.FrameForDecoding(0, &render_time_ms, false); | 81 receiver_.FrameForDecoding(0, &render_time_ms, false); |
| 81 if (!frame) | 82 if (!frame) |
| 82 return false; | 83 return false; |
| 83 receiver_.ReleaseFrame(frame); | 84 receiver_.ReleaseFrame(frame); |
| 84 return true; | 85 return true; |
| 85 } | 86 } |
| 86 | 87 |
| 87 rtc::scoped_ptr<SimulatedClock> clock_; | 88 std::unique_ptr<SimulatedClock> clock_; |
| 88 VCMTiming timing_; | 89 VCMTiming timing_; |
| 89 NullEventFactory event_factory_; | 90 NullEventFactory event_factory_; |
| 90 VCMReceiver receiver_; | 91 VCMReceiver receiver_; |
| 91 rtc::scoped_ptr<StreamGenerator> stream_generator_; | 92 std::unique_ptr<StreamGenerator> stream_generator_; |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 TEST_F(TestVCMReceiver, RenderBufferSize_AllComplete) { | 95 TEST_F(TestVCMReceiver, RenderBufferSize_AllComplete) { |
| 95 EXPECT_EQ(0, receiver_.RenderBufferSizeMs()); | 96 EXPECT_EQ(0, receiver_.RenderBufferSizeMs()); |
| 96 EXPECT_GE(InsertFrame(kVideoFrameKey, true), kNoError); | 97 EXPECT_GE(InsertFrame(kVideoFrameKey, true), kNoError); |
| 97 int num_of_frames = 10; | 98 int num_of_frames = 10; |
| 98 for (int i = 0; i < num_of_frames; ++i) { | 99 for (int i = 0; i < num_of_frames; ++i) { |
| 99 EXPECT_GE(InsertFrame(kVideoFrameDelta, true), kNoError); | 100 EXPECT_GE(InsertFrame(kVideoFrameDelta, true), kNoError); |
| 100 } | 101 } |
| 101 EXPECT_EQ(num_of_frames * kDefaultFramePeriodMs, | 102 EXPECT_EQ(num_of_frames * kDefaultFramePeriodMs, |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 class VCMReceiverTimingTest : public ::testing::Test { | 443 class VCMReceiverTimingTest : public ::testing::Test { |
| 443 protected: | 444 protected: |
| 444 VCMReceiverTimingTest() | 445 VCMReceiverTimingTest() |
| 445 | 446 |
| 446 : clock_(&stream_generator_, &receiver_), | 447 : clock_(&stream_generator_, &receiver_), |
| 447 stream_generator_(0, clock_.TimeInMilliseconds()), | 448 stream_generator_(0, clock_.TimeInMilliseconds()), |
| 448 timing_(&clock_), | 449 timing_(&clock_), |
| 449 receiver_( | 450 receiver_( |
| 450 &timing_, | 451 &timing_, |
| 451 &clock_, | 452 &clock_, |
| 452 rtc::scoped_ptr<EventWrapper>(new FrameInjectEvent(&clock_, false)), | 453 std::unique_ptr<EventWrapper>(new FrameInjectEvent(&clock_, false)), |
| 453 rtc::scoped_ptr<EventWrapper>( | 454 std::unique_ptr<EventWrapper>( |
| 454 new FrameInjectEvent(&clock_, true))) {} | 455 new FrameInjectEvent(&clock_, true))) {} |
| 455 | 456 |
| 456 virtual void SetUp() { receiver_.Reset(); } | 457 virtual void SetUp() { receiver_.Reset(); } |
| 457 | 458 |
| 458 SimulatedClockWithFrames clock_; | 459 SimulatedClockWithFrames clock_; |
| 459 StreamGenerator stream_generator_; | 460 StreamGenerator stream_generator_; |
| 460 VCMTiming timing_; | 461 VCMTiming timing_; |
| 461 VCMReceiver receiver_; | 462 VCMReceiver receiver_; |
| 462 }; | 463 }; |
| 463 | 464 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 end_time); | 567 end_time); |
| 567 receiver_.ReleaseFrame(frame); | 568 receiver_.ReleaseFrame(frame); |
| 568 ++num_frames_return; | 569 ++num_frames_return; |
| 569 } else { | 570 } else { |
| 570 EXPECT_EQ(kMaxWaitTime, end_time - start_time); | 571 EXPECT_EQ(kMaxWaitTime, end_time - start_time); |
| 571 } | 572 } |
| 572 } | 573 } |
| 573 } | 574 } |
| 574 | 575 |
| 575 } // namespace webrtc | 576 } // namespace webrtc |
| OLD | NEW |