MCPcopy Create free account
hub / github.com/cisco/openh264 / TEST_F

Function TEST_F

test/encoder/EncUT_EncoderExt.cpp:153–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153TEST_F (EncoderInterfaceTest, EncoderOptionSetTest) {
154 int iResult, iValue, iReturn;
155 float fFrameRate, fReturn;
156 int uiTraceLevel = WELS_LOG_QUIET;
157
158 pPtrEnc->SetOption (ENCODER_OPTION_TRACE_LEVEL, &uiTraceLevel);
159
160 InitializeParamExt();
161 iResult = pPtrEnc->InitializeExt (pParamExt);
162 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
163
164 PrepareOneSrcFrame();
165
166 ENCODER_OPTION eOptionId = ENCODER_OPTION_DATAFORMAT;
167 iValue = rand() % 256;
168 iResult = pPtrEnc->SetOption (eOptionId, &iValue);
169
170 if (iValue == 0)
171 EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
172 else
173 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
174
175 iResult = pPtrEnc->GetOption (eOptionId, &iReturn);
176 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
177 EXPECT_EQ (iValue, iReturn);
178
179 iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
180 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
181 pSrcPic->uiTimeStamp += 30;
182
183 eOptionId = ENCODER_OPTION_IDR_INTERVAL;
184 iValue = rand() % 256 - 5;
185 iResult = pPtrEnc->SetOption (eOptionId, &iValue);
186 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
187
188 iResult = pPtrEnc->GetOption (eOptionId, &iReturn);
189 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
190 if (iValue <= -1)
191 iValue = 0;
192 EXPECT_EQ (iValue, iReturn);
193
194 PrepareOneSrcFrame();
195 iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
196 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
197 pSrcPic->uiTimeStamp += 30;
198
199 eOptionId = ENCODER_OPTION_FRAME_RATE;
200 fFrameRate = static_cast<float> (rand() % 100 - 5);
201 iResult = pPtrEnc->SetOption (eOptionId, &fFrameRate);
202
203 if (fFrameRate <= 0)
204 EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
205 else {
206 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
207
208 fFrameRate = WELS_CLIP3 (fFrameRate, 1, 60);
209 iResult = pPtrEnc->GetOption (eOptionId, &fReturn);
210 EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));

Callers

nothing calls this directly

Calls 12

GetValidEncParamBaseFunction · 0.85
SetOptionMethod · 0.45
InitializeExtMethod · 0.45
GetOptionMethod · 0.45
EncodeFrameMethod · 0.45
UninitializeMethod · 0.45
InitializeMethod · 0.45
GetDefaultParamsMethod · 0.45
ForceIntraFrameMethod · 0.45
EncodeParameterSetsMethod · 0.45
OpenMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected