OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include "webrtc/video/encoder_state_feedback.h" | 11 #include "webrtc/video/encoder_rtcp_feedback.h" |
12 | 12 |
13 #include "webrtc/modules/utility/include/mock/mock_process_thread.h" | 13 #include "webrtc/modules/utility/include/mock/mock_process_thread.h" |
14 #include "webrtc/test/gmock.h" | 14 #include "webrtc/test/gmock.h" |
15 #include "webrtc/test/gtest.h" | 15 #include "webrtc/test/gtest.h" |
16 #include "webrtc/video/vie_encoder.h" | 16 #include "webrtc/video/vie_encoder.h" |
17 | 17 |
18 using ::testing::NiceMock; | 18 using ::testing::NiceMock; |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
(...skipping 10 matching lines...) Expand all Loading... |
32 | 32 |
33 MOCK_METHOD1(OnReceivedIntraFrameRequest, void(size_t)); | 33 MOCK_METHOD1(OnReceivedIntraFrameRequest, void(size_t)); |
34 MOCK_METHOD1(OnReceivedSLI, void(uint8_t picture_id)); | 34 MOCK_METHOD1(OnReceivedSLI, void(uint8_t picture_id)); |
35 MOCK_METHOD1(OnReceivedRPSI, void(uint64_t picture_id)); | 35 MOCK_METHOD1(OnReceivedRPSI, void(uint64_t picture_id)); |
36 }; | 36 }; |
37 | 37 |
38 class VieKeyRequestTest : public ::testing::Test { | 38 class VieKeyRequestTest : public ::testing::Test { |
39 public: | 39 public: |
40 VieKeyRequestTest() | 40 VieKeyRequestTest() |
41 : simulated_clock_(123456789), | 41 : simulated_clock_(123456789), |
42 encoder_state_feedback_( | 42 encoder_rtcp_feedback_( |
43 &simulated_clock_, | 43 &simulated_clock_, |
44 std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc), | 44 std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc), |
45 &encoder_) {} | 45 &encoder_) {} |
46 | 46 |
47 protected: | 47 protected: |
48 const uint32_t kSsrc = 1234; | 48 const uint32_t kSsrc = 1234; |
49 MockVieEncoder encoder_; | 49 MockVieEncoder encoder_; |
50 SimulatedClock simulated_clock_; | 50 SimulatedClock simulated_clock_; |
51 EncoderStateFeedback encoder_state_feedback_; | 51 EncoderRtcpFeedback encoder_rtcp_feedback_; |
52 }; | 52 }; |
53 | 53 |
54 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { | 54 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { |
55 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); | 55 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); |
56 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 56 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
57 | 57 |
58 const uint8_t sli_picture_id = 3; | 58 const uint8_t sli_picture_id = 3; |
59 EXPECT_CALL(encoder_, OnReceivedSLI(sli_picture_id)).Times(1); | 59 EXPECT_CALL(encoder_, OnReceivedSLI(sli_picture_id)).Times(1); |
60 encoder_state_feedback_.OnReceivedSLI(kSsrc, sli_picture_id); | 60 encoder_rtcp_feedback_.OnReceivedSLI(kSsrc, sli_picture_id); |
61 | 61 |
62 const uint64_t rpsi_picture_id = 9; | 62 const uint64_t rpsi_picture_id = 9; |
63 EXPECT_CALL(encoder_, OnReceivedRPSI(rpsi_picture_id)).Times(1); | 63 EXPECT_CALL(encoder_, OnReceivedRPSI(rpsi_picture_id)).Times(1); |
64 encoder_state_feedback_.OnReceivedRPSI(kSsrc, rpsi_picture_id); | 64 encoder_rtcp_feedback_.OnReceivedRPSI(kSsrc, rpsi_picture_id); |
65 } | 65 } |
66 | 66 |
67 TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) { | 67 TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) { |
68 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); | 68 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); |
69 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 69 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
70 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 70 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
71 simulated_clock_.AdvanceTimeMilliseconds(10); | 71 simulated_clock_.AdvanceTimeMilliseconds(10); |
72 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 72 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
73 | 73 |
74 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); | 74 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); |
75 simulated_clock_.AdvanceTimeMilliseconds(300); | 75 simulated_clock_.AdvanceTimeMilliseconds(300); |
76 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 76 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
77 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 77 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
78 encoder_state_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 78 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
79 } | 79 } |
80 | 80 |
81 } // namespace webrtc | 81 } // namespace webrtc |
OLD | NEW |