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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 explicit MockVieEncoder(SendStatisticsProxy* send_stats_proxy) | 25 explicit MockVieEncoder(SendStatisticsProxy* send_stats_proxy) |
26 : ViEEncoder(1, | 26 : ViEEncoder(1, |
27 send_stats_proxy, | 27 send_stats_proxy, |
28 VideoSendStream::Config::EncoderSettings("fake", 0, nullptr), | 28 VideoSendStream::Config::EncoderSettings("fake", 0, nullptr), |
29 nullptr, | 29 nullptr, |
30 nullptr) {} | 30 nullptr) {} |
31 ~MockVieEncoder() { Stop(); } | 31 ~MockVieEncoder() { Stop(); } |
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)); | |
35 MOCK_METHOD1(OnReceivedRPSI, void(uint64_t picture_id)); | |
36 }; | 34 }; |
37 | 35 |
38 class VieKeyRequestTest : public ::testing::Test { | 36 class VieKeyRequestTest : public ::testing::Test { |
39 public: | 37 public: |
40 VieKeyRequestTest() | 38 VieKeyRequestTest() |
41 : simulated_clock_(123456789), | 39 : simulated_clock_(123456789), |
42 send_stats_proxy_(&simulated_clock_, | 40 send_stats_proxy_(&simulated_clock_, |
43 VideoSendStream::Config(nullptr), | 41 VideoSendStream::Config(nullptr), |
44 VideoEncoderConfig::ContentType::kRealtimeVideo), | 42 VideoEncoderConfig::ContentType::kRealtimeVideo), |
45 encoder_(&send_stats_proxy_), | 43 encoder_(&send_stats_proxy_), |
46 encoder_rtcp_feedback_( | 44 encoder_rtcp_feedback_( |
47 &simulated_clock_, | 45 &simulated_clock_, |
48 std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc), | 46 std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc), |
49 &encoder_) {} | 47 &encoder_) {} |
50 | 48 |
51 protected: | 49 protected: |
52 const uint32_t kSsrc = 1234; | 50 const uint32_t kSsrc = 1234; |
53 | 51 |
54 SimulatedClock simulated_clock_; | 52 SimulatedClock simulated_clock_; |
55 SendStatisticsProxy send_stats_proxy_; | 53 SendStatisticsProxy send_stats_proxy_; |
56 MockVieEncoder encoder_; | 54 MockVieEncoder encoder_; |
57 EncoderRtcpFeedback encoder_rtcp_feedback_; | 55 EncoderRtcpFeedback encoder_rtcp_feedback_; |
58 }; | 56 }; |
59 | 57 |
60 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { | 58 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { |
61 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); | 59 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); |
62 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 60 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
63 | |
64 const uint8_t sli_picture_id = 3; | |
65 EXPECT_CALL(encoder_, OnReceivedSLI(sli_picture_id)).Times(1); | |
66 encoder_rtcp_feedback_.OnReceivedSLI(kSsrc, sli_picture_id); | |
67 | |
68 const uint64_t rpsi_picture_id = 9; | |
69 EXPECT_CALL(encoder_, OnReceivedRPSI(rpsi_picture_id)).Times(1); | |
70 encoder_rtcp_feedback_.OnReceivedRPSI(kSsrc, rpsi_picture_id); | |
71 } | 61 } |
72 | 62 |
73 TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) { | 63 TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) { |
74 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); | 64 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); |
75 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 65 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
76 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 66 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
77 simulated_clock_.AdvanceTimeMilliseconds(10); | 67 simulated_clock_.AdvanceTimeMilliseconds(10); |
78 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 68 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
79 | 69 |
80 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); | 70 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); |
81 simulated_clock_.AdvanceTimeMilliseconds(300); | 71 simulated_clock_.AdvanceTimeMilliseconds(300); |
82 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 72 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
83 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 73 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
84 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); | 74 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); |
85 } | 75 } |
86 | 76 |
87 } // namespace webrtc | 77 } // namespace webrtc |
OLD | NEW |