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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 rtc::scoped_ptr<MockProcessThread> process_thread_; | 62 rtc::scoped_ptr<MockProcessThread> process_thread_; |
63 rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_; | 63 rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_; |
64 PacketRouter router_; | 64 PacketRouter router_; |
65 PacedSender pacer_; | 65 PacedSender pacer_; |
66 }; | 66 }; |
67 | 67 |
68 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { | 68 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { |
69 const int ssrc = 1234; | 69 const int ssrc = 1234; |
70 MockVieEncoder encoder(process_thread_.get(), &pacer_); | 70 MockVieEncoder encoder(process_thread_.get(), &pacer_); |
71 EXPECT_TRUE(encoder_state_feedback_->AddEncoder(ssrc, &encoder)); | 71 encoder_state_feedback_->AddEncoder(std::vector<uint32_t>(1, ssrc), &encoder); |
72 | 72 |
73 EXPECT_CALL(encoder, OnReceivedIntraFrameRequest(ssrc)) | 73 EXPECT_CALL(encoder, OnReceivedIntraFrameRequest(ssrc)) |
74 .Times(1); | 74 .Times(1); |
75 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> | 75 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> |
76 OnReceivedIntraFrameRequest(ssrc); | 76 OnReceivedIntraFrameRequest(ssrc); |
77 | 77 |
78 const uint8_t sli_picture_id = 3; | 78 const uint8_t sli_picture_id = 3; |
79 EXPECT_CALL(encoder, OnReceivedSLI(ssrc, sli_picture_id)) | 79 EXPECT_CALL(encoder, OnReceivedSLI(ssrc, sli_picture_id)) |
80 .Times(1); | 80 .Times(1); |
81 encoder_state_feedback_->GetRtcpIntraFrameObserver()->OnReceivedSLI( | 81 encoder_state_feedback_->GetRtcpIntraFrameObserver()->OnReceivedSLI( |
82 ssrc, sli_picture_id); | 82 ssrc, sli_picture_id); |
83 | 83 |
84 const uint64_t rpsi_picture_id = 9; | 84 const uint64_t rpsi_picture_id = 9; |
85 EXPECT_CALL(encoder, OnReceivedRPSI(ssrc, rpsi_picture_id)) | 85 EXPECT_CALL(encoder, OnReceivedRPSI(ssrc, rpsi_picture_id)) |
86 .Times(1); | 86 .Times(1); |
87 encoder_state_feedback_->GetRtcpIntraFrameObserver()->OnReceivedRPSI( | 87 encoder_state_feedback_->GetRtcpIntraFrameObserver()->OnReceivedRPSI( |
88 ssrc, rpsi_picture_id); | 88 ssrc, rpsi_picture_id); |
89 | 89 |
90 encoder_state_feedback_->RemoveEncoder(&encoder); | 90 encoder_state_feedback_->RemoveEncoder(&encoder); |
91 } | 91 } |
92 | 92 |
93 // Register multiple encoders and make sure the request is relayed to correct | 93 // Register multiple encoders and make sure the request is relayed to correct |
94 // ViEEncoder. | 94 // ViEEncoder. |
95 TEST_F(VieKeyRequestTest, MultipleEncoders) { | 95 TEST_F(VieKeyRequestTest, MultipleEncoders) { |
96 const int ssrc_1 = 1234; | 96 const int ssrc_1 = 1234; |
97 const int ssrc_2 = 5678; | 97 const int ssrc_2 = 5678; |
98 MockVieEncoder encoder_1(process_thread_.get(), &pacer_); | 98 MockVieEncoder encoder_1(process_thread_.get(), &pacer_); |
99 MockVieEncoder encoder_2(process_thread_.get(), &pacer_); | 99 MockVieEncoder encoder_2(process_thread_.get(), &pacer_); |
100 EXPECT_TRUE(encoder_state_feedback_->AddEncoder(ssrc_1, &encoder_1)); | 100 encoder_state_feedback_->AddEncoder(std::vector<uint32_t>(1, ssrc_1), |
101 EXPECT_TRUE(encoder_state_feedback_->AddEncoder(ssrc_2, &encoder_2)); | 101 &encoder_1); |
| 102 encoder_state_feedback_->AddEncoder(std::vector<uint32_t>(1, ssrc_2), |
| 103 &encoder_2); |
102 | 104 |
103 EXPECT_CALL(encoder_1, OnReceivedIntraFrameRequest(ssrc_1)) | 105 EXPECT_CALL(encoder_1, OnReceivedIntraFrameRequest(ssrc_1)) |
104 .Times(1); | 106 .Times(1); |
105 EXPECT_CALL(encoder_2, OnReceivedIntraFrameRequest(ssrc_2)) | 107 EXPECT_CALL(encoder_2, OnReceivedIntraFrameRequest(ssrc_2)) |
106 .Times(1); | 108 .Times(1); |
107 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> | 109 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> |
108 OnReceivedIntraFrameRequest(ssrc_1); | 110 OnReceivedIntraFrameRequest(ssrc_1); |
109 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> | 111 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> |
110 OnReceivedIntraFrameRequest(ssrc_2); | 112 OnReceivedIntraFrameRequest(ssrc_2); |
111 | 113 |
(...skipping 20 matching lines...) Expand all Loading... |
132 ssrc_2, rpsi_pid_2); | 134 ssrc_2, rpsi_pid_2); |
133 | 135 |
134 encoder_state_feedback_->RemoveEncoder(&encoder_1); | 136 encoder_state_feedback_->RemoveEncoder(&encoder_1); |
135 EXPECT_CALL(encoder_2, OnReceivedIntraFrameRequest(ssrc_2)) | 137 EXPECT_CALL(encoder_2, OnReceivedIntraFrameRequest(ssrc_2)) |
136 .Times(1); | 138 .Times(1); |
137 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> | 139 encoder_state_feedback_->GetRtcpIntraFrameObserver()-> |
138 OnReceivedIntraFrameRequest(ssrc_2); | 140 OnReceivedIntraFrameRequest(ssrc_2); |
139 encoder_state_feedback_->RemoveEncoder(&encoder_2); | 141 encoder_state_feedback_->RemoveEncoder(&encoder_2); |
140 } | 142 } |
141 | 143 |
142 TEST_F(VieKeyRequestTest, AddTwiceError) { | |
143 const int ssrc = 1234; | |
144 MockVieEncoder encoder(process_thread_.get(), &pacer_); | |
145 EXPECT_TRUE(encoder_state_feedback_->AddEncoder(ssrc, &encoder)); | |
146 EXPECT_FALSE(encoder_state_feedback_->AddEncoder(ssrc, &encoder)); | |
147 encoder_state_feedback_->RemoveEncoder(&encoder); | |
148 } | |
149 | |
150 } // namespace webrtc | 144 } // namespace webrtc |
OLD | NEW |