OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 public: | 65 public: |
66 explicit VCMJitterEstimatorMock(Clock* clock) : VCMJitterEstimator(clock) {} | 66 explicit VCMJitterEstimatorMock(Clock* clock) : VCMJitterEstimator(clock) {} |
67 | 67 |
68 MOCK_METHOD1(UpdateRtt, void(int64_t rttMs)); | 68 MOCK_METHOD1(UpdateRtt, void(int64_t rttMs)); |
69 MOCK_METHOD3(UpdateEstimate, | 69 MOCK_METHOD3(UpdateEstimate, |
70 void(int64_t frameDelayMs, | 70 void(int64_t frameDelayMs, |
71 uint32_t frameSizeBytes, | 71 uint32_t frameSizeBytes, |
72 bool incompleteFrame)); | 72 bool incompleteFrame)); |
73 }; | 73 }; |
74 | 74 |
75 class FrameObjectMock : public FrameObject { | 75 class FrameObjectFake : public FrameObject { |
76 public: | 76 public: |
77 MOCK_CONST_METHOD1(GetBitstream, bool(uint8_t* destination)); | 77 bool GetBitstream(uint8_t* destination) const override { return true; } |
| 78 |
| 79 uint32_t Timestamp() const override { return timestamp; } |
| 80 |
| 81 int64_t ReceivedTime() const override { return 0; } |
| 82 |
| 83 int64_t RenderTime() const override { return _renderTimeMs; } |
78 }; | 84 }; |
79 | 85 |
80 class TestFrameBuffer2 : public ::testing::Test { | 86 class TestFrameBuffer2 : public ::testing::Test { |
81 protected: | 87 protected: |
82 static constexpr int kMaxReferences = 5; | 88 static constexpr int kMaxReferences = 5; |
83 static constexpr int kFps1 = 1000; | 89 static constexpr int kFps1 = 1000; |
84 static constexpr int kFps10 = kFps1 / 10; | 90 static constexpr int kFps10 = kFps1 / 10; |
85 static constexpr int kFps20 = kFps1 / 20; | 91 static constexpr int kFps20 = kFps1 / 20; |
86 | 92 |
87 TestFrameBuffer2() | 93 TestFrameBuffer2() |
(...skipping 18 matching lines...) Expand all Loading... |
106 template <typename... T> | 112 template <typename... T> |
107 void InsertFrame(uint16_t picture_id, | 113 void InsertFrame(uint16_t picture_id, |
108 uint8_t spatial_layer, | 114 uint8_t spatial_layer, |
109 int64_t ts_ms, | 115 int64_t ts_ms, |
110 bool inter_layer_predicted, | 116 bool inter_layer_predicted, |
111 T... refs) { | 117 T... refs) { |
112 static_assert(sizeof...(refs) <= kMaxReferences, | 118 static_assert(sizeof...(refs) <= kMaxReferences, |
113 "To many references specified for FrameObject."); | 119 "To many references specified for FrameObject."); |
114 std::array<uint16_t, sizeof...(refs)> references = {{refs...}}; | 120 std::array<uint16_t, sizeof...(refs)> references = {{refs...}}; |
115 | 121 |
116 std::unique_ptr<FrameObjectMock> frame(new FrameObjectMock()); | 122 std::unique_ptr<FrameObjectFake> frame(new FrameObjectFake()); |
117 frame->picture_id = picture_id; | 123 frame->picture_id = picture_id; |
118 frame->spatial_layer = spatial_layer; | 124 frame->spatial_layer = spatial_layer; |
119 frame->timestamp = ts_ms * 90; | 125 frame->timestamp = ts_ms * 90; |
120 frame->num_references = references.size(); | 126 frame->num_references = references.size(); |
121 frame->inter_layer_predicted = inter_layer_predicted; | 127 frame->inter_layer_predicted = inter_layer_predicted; |
122 for (size_t r = 0; r < references.size(); ++r) | 128 for (size_t r = 0; r < references.size(); ++r) |
123 frame->references[r] = references[r]; | 129 frame->references[r] = references[r]; |
124 | 130 |
125 buffer_.InsertFrame(std::move(frame)); | 131 buffer_.InsertFrame(std::move(frame)); |
126 } | 132 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 InsertFrame(pid + 1, 0, ts, false, pid); | 331 InsertFrame(pid + 1, 0, ts, false, pid); |
326 ExtractFrame(); | 332 ExtractFrame(); |
327 | 333 |
328 CheckFrame(0, pid, 0); | 334 CheckFrame(0, pid, 0); |
329 CheckFrame(1, pid + 2, 0); | 335 CheckFrame(1, pid + 2, 0); |
330 CheckNoFrame(2); | 336 CheckNoFrame(2); |
331 } | 337 } |
332 | 338 |
333 } // namespace video_coding | 339 } // namespace video_coding |
334 } // namespace webrtc | 340 } // namespace webrtc |
OLD | NEW |