1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "codec_param_checker_test.h"
16 #include <gtest/gtest.h>
17 #include "avcodec_info.h"
18 #include "avcodec_list.h"
19 #include "avcodec_video_encoder.h"
20 #include "format.h"
21 #include "media_description.h"
22 #include "avcodec_errors.h"
23 #include "av_common.h"
24 using namespace OHOS::MediaAVCodec;
25 using namespace testing::ext;
26 namespace {
27 uint32_t DEFAULT_QUALITY = 30; // 30 默认值
28 uint32_t DEFAULT_BITRATE = 10000000; // 10000000 默认值
29 uint32_t DEFAULT_MAX_BITRATE = 20000000; // 20000000 默认值
30 uint32_t DEFAULT_SQR_FACTOR = 30; // 30 默认值
31
SetFormatBasicParam(Format & format)32 void SetFormatBasicParam(Format &format)
33 {
34 format = Format();
35 format.PutIntValue(MediaDescriptionKey::MD_KEY_WIDTH, 1280); // 1280 w默认值
36 format.PutIntValue(MediaDescriptionKey::MD_KEY_HEIGHT, 720); // 720 h默认值
37 format.PutIntValue(MediaDescriptionKey::MD_KEY_PIXEL_FORMAT,
38 static_cast<int32_t>(VideoPixelFormat::SURFACE_FORMAT));
39 }
40
IsEncoderBitrateModeSupported(CapabilityData * capData,VideoEncodeBitrateMode bitrateMode)41 bool IsEncoderBitrateModeSupported(CapabilityData *capData, VideoEncodeBitrateMode bitrateMode)
42 {
43 if (!AVCodecInfo::isEncoder(capData->codecType)) {
44 return false;
45 }
46 std::shared_ptr<VideoCaps> codecInfo = std::make_shared<VideoCaps>(capData);
47 const auto &bitrateModeVec = codecInfo->GetSupportedBitrateMode();
48 return find(bitrateModeVec.begin(), bitrateModeVec.end(), bitrateMode) != bitrateModeVec.end();
49 }
50
51 /**
52 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1519
53 * @tc.desc: codec video configure sqr_factor and quality exist value
54 * @tc.type: FUNC
55 */
56 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1519, TestSize.Level3)
57 {
58 SetFormatBasicParam(formatInner_);
59 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
60 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_QUALITY, DEFAULT_QUALITY);
61 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
62 }
63
64 /**
65 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1520
66 * @tc.desc: codec video configure max_bitrate and quality exist value
67 * @tc.type: FUNC
68 */
69 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1520, TestSize.Level3)
70 {
71 SetFormatBasicParam(formatInner_);
72 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
73 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_QUALITY, DEFAULT_QUALITY);
74 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
75 }
76
77 /**
78 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1521
79 * @tc.desc: codec video configure bitrate and max_bitrate exist value
80 * @tc.type: FUNC
81 */
82 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1521, TestSize.Level3)
83 {
84 SetFormatBasicParam(formatInner_);
85 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_BITRATE, DEFAULT_BITRATE);
86 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
87 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
88 }
89 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
90 }
91
92 /**
93 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1522
94 * @tc.desc: codec video configure max_bitrate in range and bitrate mode is CQ
95 * @tc.type: FUNC
96 */
97 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1522, TestSize.Level3)
98 {
99 SetFormatBasicParam(formatInner_);
100 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
101 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, CQ)) {
102 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, CQ);
103 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
104 }
105 }
106
107 /**
108 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1523
109 * @tc.desc: codec video configure quality in range and bitrate mode is SQR
110 * @tc.type: FUNC
111 */
112 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1523, TestSize.Level3)
113 {
114 SetFormatBasicParam(formatInner_);
115 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_QUALITY, DEFAULT_QUALITY);
116
117 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
118 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
119 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
120 }
121 }
122
123 /**
124 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1524
125 * @tc.desc: codec video configure sqr_factor in range and bitrate mode is VBR
126 * @tc.type: FUNC
127 */
128 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1524, TestSize.Level3)
129 {
130 SetFormatBasicParam(formatInner_);
131 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
132
133 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, VBR)) {
134 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, VBR);
135 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
136 }
137 }
138
139 /**
140 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1525
141 * @tc.desc: codec video configure sqr_factor in range and bitrate mode is CBR
142 * @tc.type: FUNC
143 */
144 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1525, TestSize.Level3)
145 {
146 SetFormatBasicParam(formatInner_);
147 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
148
149 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, CBR)) {
150 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, CBR);
151 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
152 }
153 }
154
155 /**
156 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1526
157 * @tc.desc: codec video configure sqr_factor in range and bitrate mode is CQ
158 * @tc.type: FUNC
159 */
160 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1526, TestSize.Level3)
161 {
162 SetFormatBasicParam(formatInner_);
163 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
164
165 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, CQ)) {
166 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, CQ);
167 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
168 }
169 }
170
171 /**
172 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1527
173 * @tc.desc: bitrate mode SQR is not supported
174 * @tc.type: FUNC
175 */
176 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1527, TestSize.Level3)
177 {
178 SetFormatBasicParam(formatInner_);
179 if (!IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
180 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
181 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
182 }
183 }
184
185 /**
186 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1528
187 * @tc.desc: codec video configure sqr_factor in range but SQR is not supported
188 * @tc.type: FUNC
189 */
190 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1528, TestSize.Level3)
191 {
192 SetFormatBasicParam(formatInner_);
193 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
194 if (!IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
195 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
196 }
197 }
198
199 /**
200 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1529
201 * @tc.desc: codec video configure max_bitrate invalid value
202 * @tc.type: FUNC
203 */
204 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1529, TestSize.Level3)
205 {
206 SetFormatBasicParam(formatInner_);
207 std::shared_ptr<VideoCaps> codecInfo = std::make_shared<VideoCaps>(capabilityDataHevc_);
208 const auto &maxBitrateRange = codecInfo->GetSupportedMaxBitrate();
209 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, maxBitrateRange.maxVal + 1);
210 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
211 }
212
213 /**
214 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1530
215 * @tc.desc: codec video configure max_bitrate invalid value
216 * @tc.type: FUNC
217 */
218 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1530, TestSize.Level3)
219 {
220 SetFormatBasicParam(formatInner_);
221 std::shared_ptr<VideoCaps> codecInfo = std::make_shared<VideoCaps>(capabilityDataHevc_);
222 const auto &maxBitrateRange = codecInfo->GetSupportedMaxBitrate();
223 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, maxBitrateRange.minVal - 1);
224 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
225 }
226
227 /**
228 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1531
229 * @tc.desc: codec video configure sqr_factor out of range
230 * @tc.type: FUNC
231 */
232 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1531, TestSize.Level3)
233 {
234 SetFormatBasicParam(formatInner_);
235 std::shared_ptr<VideoCaps> codecInfo = std::make_shared<VideoCaps>(capabilityDataHevc_);
236 const auto &sqrFactorRange = codecInfo->GetSupportedSqrFactor();
237 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, sqrFactorRange.minVal - 1);
238 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
239 }
240
241 /**
242 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1532
243 * @tc.desc: codec video configure sqr_factor out of range
244 * @tc.type: FUNC
245 */
246 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1532, TestSize.Level3)
247 {
248 SetFormatBasicParam(formatInner_);
249 std::shared_ptr<VideoCaps> codecInfo = std::make_shared<VideoCaps>(capabilityDataHevc_);
250 const auto &sqrFactorRange = codecInfo->GetSupportedSqrFactor();
251 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, sqrFactorRange.maxVal + 1);
252 ASSERT_EQ(AVCS_ERR_CODEC_PARAM_INCORRECT, videoEncHevcInner_->Configure(formatInner_));
253 }
254
255 /**
256 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1533
257 * @tc.desc: SQR is supported
258 * @tc.type: FUNC
259 */
260 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1533, TestSize.Level3)
261 {
262 SetFormatBasicParam(formatInner_);
263 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
264 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
265 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
266 }
267 }
268
269 /**
270 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1534
271 * @tc.desc: codec video configure bitrate exist value and mode is SQR
272 * @tc.type: FUNC
273 */
274 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1534, TestSize.Level3)
275 {
276 SetFormatBasicParam(formatInner_);
277 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
278 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
279 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_BITRATE, DEFAULT_BITRATE);
280 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
281 }
282 }
283
284 /**
285 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1535
286 * @tc.desc: codec video configure max_bitrate exist value and mode is SQR
287 * @tc.type: FUNC
288 */
289 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1535, TestSize.Level3)
290 {
291 SetFormatBasicParam(formatInner_);
292 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
293 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
294 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
295 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
296 }
297 }
298
299 /**
300 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1536
301 * @tc.desc: codec video configure bitrate and max_bitrate exist value and mode is SQR
302 * @tc.type: FUNC
303 */
304 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1536, TestSize.Level3)
305 {
306 SetFormatBasicParam(formatInner_);
307 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
308 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
309 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_BITRATE, DEFAULT_BITRATE);
310 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
311 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
312 }
313 }
314
315 /**
316 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1537
317 * @tc.desc: codec video configure bitrate、max_bitrate and sqr_factor exist value and mode is SQR
318 * @tc.type: FUNC
319 */
320 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1537, TestSize.Level3)
321 {
322 SetFormatBasicParam(formatInner_);
323 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
324 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODE_BITRATE_MODE, SQR);
325 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_BITRATE, DEFAULT_BITRATE);
326 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
327 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
328 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
329 }
330 }
331
332 /**
333 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1539
334 * @tc.desc: codec video configure bitrate、max_bitrate and sqr_factor exist value and SQR is support
335 * @tc.type: FUNC
336 */
337 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1539, TestSize.Level3)
338 {
339 SetFormatBasicParam(formatInner_);
340 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
341 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_BITRATE, DEFAULT_BITRATE);
342 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
343 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
344 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
345 }
346 }
347
348 /**
349 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1540
350 * @tc.desc: codec video configure bitrate and sqr_factor exist value and SQR is support
351 * @tc.type: FUNC
352 */
353 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1540, TestSize.Level3)
354 {
355 SetFormatBasicParam(formatInner_);
356 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
357 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_BITRATE, DEFAULT_BITRATE);
358 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
359 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
360 }
361 }
362
363 /**
364 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1541
365 * @tc.desc: codec video configure max_bitrate and sqr_factor exist value and SQR is support
366 * @tc.type: FUNC
367 */
368 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1541, TestSize.Level3)
369 {
370 SetFormatBasicParam(formatInner_);
371 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
372 formatInner_.PutLongValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_MAX_BITRATE, DEFAULT_MAX_BITRATE);
373 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
374 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
375 }
376 }
377
378 /**
379 * @tc.name: ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1542
380 * @tc.desc: codec video configure sqr_factor exist value and SQR is support
381 * @tc.type: FUNC
382 */
383 HWTEST_F(AVCodecParamCheckerTest, ENCODE_KEY_BITRATE_QUALLITY_INVALID_TEST_1542, TestSize.Level3)
384 {
385 SetFormatBasicParam(formatInner_);
386 if (IsEncoderBitrateModeSupported(capabilityDataHevc_, SQR)) {
387 formatInner_.PutIntValue(MediaDescriptionKey::MD_KEY_VIDEO_ENCODER_SQR_FACTOR, DEFAULT_SQR_FACTOR);
388 ASSERT_EQ(AVCS_ERR_OK, videoEncHevcInner_->Configure(formatInner_));
389 }
390 }
391 }