• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 
16 #include <gtest/gtest.h>
17 #include <osal_mem.h>
18 #include <securec.h>
19 #include <unistd.h>
20 #include "codec_callback_stub.h"
21 #include "hdf_log.h"
22 #include "icodec.h"
23 #include "share_mem.h"
24 
25 #define HDF_LOG_TAG codec_hdi_uinttest
26 
27 using namespace std;
28 using namespace testing::ext;
29 
30 namespace {
31 constexpr const char *TEST_SERVICE_NAME = "codec_hdi_service";
32 constexpr const int TEST_PACKET_BUFFER_SIZE = 4096;
33 constexpr const int TEST_FRAME_BUFFER_SIZE = (640 * 480 * 3 / 2);
34 constexpr const uint32_t QUEUE_TIME_OUT = 10;
35 constexpr const int CAPABILITY_COUNT = 9;
36 constexpr int32_t INT_TO_STR_LEN = 32;
37 constexpr int32_t ARRAY_TO_STR_LEN = 1000; // hcs array length
38 constexpr int32_t VIDEO_WIDHT = 640;
39 constexpr int32_t VIDEO_HEIGHT = 480;
40 struct ICodec *g_codecObj = nullptr;
41 ShareMemory g_inputBuffer;
42 ShareMemory g_outputBuffer;
43 CodecBuffer *g_inputInfoData = nullptr;
44 CodecBuffer *g_outputInfoData = nullptr;
45 CODEC_HANDLETYPE g_handle = NULL;
46 
47 typedef struct {
48     VideoCodecGopMode gopMode;
49     uint32_t gopLen;
50     int32_t gop;
51     int32_t viLen;
52 } HdiGopSetup;
53 
54 class CodecProxyTest : public testing::Test {
55 public:
SetUpTestCase()56     static void SetUpTestCase() {}
TearDownTestCase()57     static void TearDownTestCase() {}
SetUp()58     void SetUp() {}
TearDown()59     void TearDown() {}
60 };
61 
62 static char arrayStr[ARRAY_TO_STR_LEN];
GetArrayStr(int32_t * array,int32_t arrayLen,int32_t endValue)63 static char *GetArrayStr(int32_t *array, int32_t arrayLen, int32_t endValue)
64 {
65     int32_t len = 0;
66     int32_t totalLen = 0;
67     int32_t ret;
68     char value[INT_TO_STR_LEN];
69     ret = memset_s(arrayStr, sizeof(arrayStr), 0, sizeof(arrayStr));
70     if (ret != EOK) {
71         HDF_LOGE("%{public}s: memset_s arrayStr failed, error code: %{public}d", __func__, ret);
72         return arrayStr;
73     }
74     for (int32_t i = 0; i < arrayLen; i++) {
75         if (array[i] == endValue) {
76             break;
77         }
78         ret = memset_s(value, sizeof(value), 0, sizeof(value));
79         if (ret != EOK) {
80             HDF_LOGE("%{public}s: memset_s value failed, error code: %{public}d", __func__, ret);
81             return arrayStr;
82         }
83         ret = sprintf_s(value, sizeof(value) - 1, "0x0%X, ", array[i]);
84         if (ret < 0) {
85             HDF_LOGE("%{public}s: sprintf_s value failed, error code: %{public}d", __func__, ret);
86             return arrayStr;
87         }
88         len = strlen(value);
89         ret = memcpy_s(arrayStr + totalLen, len, value, len);
90         if (ret != EOK) {
91             HDF_LOGE("%{public}s: memcpy_s arrayStr failed, error code: %{public}d", __func__, ret);
92             return arrayStr;
93         }
94         totalLen += len;
95     }
96     return arrayStr;
97 }
98 
PrintCapability(CodecCapability * cap,int index)99 static void PrintCapability(CodecCapability *cap, int index)
100 {
101     int32_t mime = 0;
102     if (cap == NULL) {
103         HDF_LOGE("null capability!");
104         return;
105     }
106     mime = (int32_t)cap->mime;
107     if (mime < 0) {
108         HDF_LOGE("print invalid capability!");
109         return;
110     }
111     HDF_LOGI("-------------------------- capability %{public}d ---------------------------", index + 1);
112     HDF_LOGI("mime:%{public}d", cap->mime);
113     HDF_LOGI("type:%{public}d", cap->type);
114     HDF_LOGI("name:%{public}s", cap->name);
115     HDF_LOGI("supportProfiles:%{public}s", GetArrayStr(cap->supportProfiles, PROFILE_NUM, INVALID_PROFILE));
116     HDF_LOGI("isSoftwareCodec:%{public}d", cap->isSoftwareCodec);
117     HDF_LOGI("processModeMask:0x0%{public}x", cap->processModeMask);
118     HDF_LOGI("capsMask:0x0%{public}x", cap->capsMask);
119     HDF_LOGI("allocateMask:0x0%{public}x", cap->allocateMask);
120     HDF_LOGI("inputBufferNum.min:%{public}d", cap->inputBufferNum.min);
121     HDF_LOGI("inputBufferNum.max:%{public}d", cap->inputBufferNum.max);
122     HDF_LOGI("outputBufferNum.min:%{public}d", cap->outputBufferNum.min);
123     HDF_LOGI("outputBufferNum.max:%{public}d", cap->outputBufferNum.max);
124     HDF_LOGI("bitRate.min:%{public}d", cap->bitRate.min);
125     HDF_LOGI("bitRate.max:%{public}d", cap->bitRate.max);
126     HDF_LOGI("inputBufferSize:%{public}d", cap->inputBufferSize);
127     HDF_LOGI("outputBufferSize:%{public}d", cap->outputBufferSize);
128     if (cap->mime < MEDIA_MIMETYPE_AUDIO_FIRST) {
129         HDF_LOGI("minSize.width:%{public}d", cap->port.video.minSize.width);
130         HDF_LOGI("minSize.height:%{public}d", cap->port.video.minSize.height);
131         HDF_LOGI("maxSize.width:%{public}d", cap->port.video.maxSize.width);
132         HDF_LOGI("maxSize.height:%{public}d", cap->port.video.maxSize.height);
133         HDF_LOGI("widthAlignment:%{public}d", cap->port.video.whAlignment.widthAlignment);
134         HDF_LOGI("heightAlignment:%{public}d", cap->port.video.whAlignment.heightAlignment);
135         HDF_LOGI("supportPixFmts:%{public}s", GetArrayStr(cap->port.video.supportPixFmts, PIX_FMT_NUM, 0));
136     } else {
137         HDF_LOGI(":%{public}s", GetArrayStr(cap->port.audio.sampleFormats, SAMPLE_FORMAT_NUM, 0));
138         HDF_LOGI(":%{public}s", GetArrayStr(cap->port.audio.sampleRate, SAMPLE_RATE_NUM, 0));
139         HDF_LOGI(":%{public}s", GetArrayStr(cap->port.audio.channelLayouts, CHANNEL_NUM, -1));
140     }
141     HDF_LOGI("-------------------------------------------------------------------");
142 }
143 
144 HWTEST_F(CodecProxyTest, HdfCodecHdiV1GetCodecObjTest_001, TestSize.Level1)
145 {
146     g_codecObj = HdiCodecGet(TEST_SERVICE_NAME);
147     ASSERT_TRUE(g_codecObj != nullptr);
148 }
149 
150 HWTEST_F(CodecProxyTest, HdfCodecHdiV1EnumerateCapabilityTest_001, TestSize.Level1)
151 {
152     int32_t ret = HDF_SUCCESS;
153     for (int index = 0; index < CAPABILITY_COUNT; index++) {
154         CodecCapability cap;
155         ret = g_codecObj->CodecEnumerateCapability(g_codecObj, index, &cap);
156         ASSERT_EQ(ret, HDF_SUCCESS);
157         PrintCapability(&cap, index);
158     }
159 }
160 
161 HWTEST_F(CodecProxyTest, HdfCodecHdiV1GetCapabilityTest_001, TestSize.Level1)
162 {
163     CodecCapability cap;
164     int32_t ret = g_codecObj->CodecGetCapability(g_codecObj, MEDIA_MIMETYPE_IMAGE_JPEG, VIDEO_DECODER, 0, &cap);
165     ASSERT_EQ(ret, HDF_SUCCESS);
166     PrintCapability(&cap, 0);
167 }
168 
169 HWTEST_F(CodecProxyTest, HdfCodecHdiV1GetCapabilityTest_002, TestSize.Level1)
170 {
171     CodecCapability cap;
172     int32_t ret = g_codecObj->CodecGetCapability(g_codecObj, MEDIA_MIMETYPE_VIDEO_HEVC, VIDEO_DECODER, 0, &cap);
173     ASSERT_EQ(ret, HDF_SUCCESS);
174     PrintCapability(&cap, 0);
175 }
176 
177 HWTEST_F(CodecProxyTest, HdfCodecHdiV1GetCapabilityTest_003, TestSize.Level1)
178 {
179     CodecCapability cap;
180     int32_t ret = g_codecObj->CodecGetCapability(g_codecObj, MEDIA_MIMETYPE_VIDEO_AVC, VIDEO_DECODER, 0, &cap);
181     ASSERT_EQ(ret, HDF_SUCCESS);
182     PrintCapability(&cap, 0);
183 }
184 
185 HWTEST_F(CodecProxyTest, HdfCodecHdiV1InitCodecTest_001, TestSize.Level1)
186 {
187     ASSERT_TRUE(g_codecObj != nullptr);
188     int32_t errorCode = g_codecObj->CodecInit(g_codecObj);
189     ASSERT_EQ(errorCode, HDF_SUCCESS);
190 }
191 
192 HWTEST_F(CodecProxyTest, HdfCodecHdiV1CreateCodecTest_001, TestSize.Level1)
193 {
194     const char* name = "codec.avc.hardware.encoder";
195     int32_t errorCode = g_codecObj->CodecCreate(g_codecObj, name, &g_handle);
196     ASSERT_EQ(errorCode, HDF_SUCCESS);
197     ASSERT_TRUE(g_handle != nullptr);
198 }
199 
200 HWTEST_F(CodecProxyTest, HdfCodecHdiV1CreateCodecByTypeTest_001, TestSize.Level1)
201 {
202     CodecType type = VIDEO_DECODER;
203     AvCodecMime mime = MEDIA_MIMETYPE_VIDEO_AVC;
204     int32_t errorCode = g_codecObj->CodecCreateByType(g_codecObj, type, mime, &g_handle);
205     ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT);
206 }
207 
208 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetPortModeTest_001, TestSize.Level1)
209 {
210     DirectionType direct = OUTPUT_TYPE;
211     AllocateBufferMode mode = ALLOCATE_INPUT_BUFFER_CODEC_PRESET;
212     BufferType type = BUFFER_TYPE_FD;
213     int32_t errorCode = g_codecObj->CodecSetPortMode(g_codecObj, g_handle, direct, mode, type);
214     ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT);
215 }
216 
217 HWTEST_F(CodecProxyTest, HdfCodecHdiV1GetPortModeTest_001, TestSize.Level1)
218 {
219     DirectionType direct = OUTPUT_TYPE;
220     AllocateBufferMode mode;
221     BufferType type;
222     int32_t errorCode = g_codecObj->CodecGetPortMode(g_codecObj, g_handle, direct, &mode, &type);
223     ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT);
224 }
225 
226 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetVideoWidthTest_001, TestSize.Level1)
227 {
228     Param *params;
229     int paramCnt = 1;
230     params = (Param *)OsalMemAlloc(sizeof(Param)*paramCnt);
231     ASSERT_TRUE(params != nullptr);
232     params->key = KEY_VIDEO_WIDTH;
233     int32_t width = VIDEO_WIDHT;
234     params->val = (void *)&width;
235     params->size = sizeof(width);
236 
237     int32_t errorCode = g_codecObj->CodecSetParameter(g_codecObj, g_handle, params, paramCnt);
238     OsalMemFree(params);
239     ASSERT_EQ(errorCode, HDF_SUCCESS);
240 }
241 
242 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetVideoHeightTest_001, TestSize.Level1)
243 {
244     Param *params;
245     int paramCnt = 1;
246     params = (Param *)OsalMemAlloc(sizeof(Param)*paramCnt);
247     ASSERT_TRUE(params != nullptr);
248     params->key = KEY_VIDEO_HEIGHT;
249     int32_t height = VIDEO_HEIGHT;
250     params->val = (void *)&height;
251     params->size = sizeof(height);
252 
253     int32_t errorCode = g_codecObj->CodecSetParameter(g_codecObj, g_handle, params, paramCnt);
254     OsalMemFree(params);
255     ASSERT_EQ(errorCode, HDF_SUCCESS);
256 }
257 
258 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetCodecTypeTest_001, TestSize.Level1)
259 {
260     Param *params;
261     int paramCnt = 1;
262     params = (Param *)OsalMemAlloc(sizeof(Param)*paramCnt);
263     ASSERT_TRUE(params != nullptr);
264     params->key = KEY_CODEC_TYPE;
265     CodecType type = VIDEO_DECODER;
266     params->val = (void *)&type;
267     params->size = sizeof(type);
268 
269     int32_t errorCode = g_codecObj->CodecSetParameter(g_codecObj, g_handle, params, paramCnt);
270     OsalMemFree(params);
271     ASSERT_EQ(errorCode, HDF_SUCCESS);
272 }
273 
274 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetGopModeTest_001, TestSize.Level1)
275 {
276     Param *params;
277     int paramCnt = 1;
278     params = (Param *)OsalMemAlloc(sizeof(Param)*paramCnt);
279     ASSERT_TRUE(params != nullptr);
280 
281     HdiGopSetup gop;
282     gop.gopMode = VID_CODEC_GOPMODE_NORMALP;
283     gop.gopLen = 0;
284     gop.viLen = 0;
285     gop.gop = 48;
286     params->key = KEY_VIDEO_GOP_MODE;
287     params->val = (void *)&gop;
288     params->size = sizeof(gop);
289 
290     int32_t errorCode = g_codecObj->CodecSetParameter(g_codecObj, g_handle, params, paramCnt);
291     OsalMemFree(params);
292     ASSERT_EQ(errorCode, HDF_SUCCESS);
293 }
294 
295 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetMimeTypeTest_001, TestSize.Level1)
296 {
297     Param *params;
298     int paramCnt = 1;
299     params = (Param *)OsalMemAlloc(sizeof(Param)*paramCnt);
300     ASSERT_TRUE(params != nullptr);
301     params->key = KEY_MIMETYPE;
302     AvCodecMime mime = MEDIA_MIMETYPE_IMAGE_JPEG;
303     params->val = (void *)&mime;
304     params->size = sizeof(mime);
305 
306     int32_t errorCode = g_codecObj->CodecSetParameter(g_codecObj, g_handle, params, paramCnt);
307     OsalMemFree(params);
308     ASSERT_EQ(errorCode, HDF_SUCCESS);
309 }
310 
311 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetPixelFormatTest_001, TestSize.Level1)
312 {
313     Param *params;
314     int paramCnt = 1;
315     params = (Param *)OsalMemAlloc(sizeof(Param)*paramCnt);
316     ASSERT_TRUE(params != nullptr);
317     params->key = KEY_PIXEL_FORMAT;
318     PixelFormat format = PIXEL_FMT_YCBCR_420_SP;
319     params->val = (void *)&format;
320     params->size = sizeof(format);
321 
322     int32_t errorCode = g_codecObj->CodecSetParameter(g_codecObj, g_handle, params, paramCnt);
323     OsalMemFree(params);
324     ASSERT_EQ(errorCode, HDF_SUCCESS);
325 }
326 
327 HWTEST_F(CodecProxyTest, HdfCodecHdiV1QueueInputTest_001, TestSize.Level1)
328 {
329     g_inputBuffer.id = 0;
330     g_inputBuffer.size = TEST_PACKET_BUFFER_SIZE;
331     int32_t ret = CreateFdShareMemory(&g_inputBuffer);
332     ASSERT_EQ(ret, HDF_SUCCESS);
333 
334     g_inputInfoData = (CodecBuffer *)OsalMemAlloc(sizeof(CodecBuffer) + sizeof(CodecBufferInfo) * 1);
335     ASSERT_TRUE(g_inputInfoData != nullptr);
336     g_inputInfoData->bufferId = 0;
337     g_inputInfoData->bufferCnt = 1;
338     g_inputInfoData->flag = 1;
339     g_inputInfoData->timeStamp = 1;
340     g_inputInfoData->buffer[0].type = BUFFER_TYPE_FD;
341     g_inputInfoData->buffer[0].offset = 1;
342     g_inputInfoData->buffer[0].length = 1;
343     g_inputInfoData->buffer[0].capacity = TEST_PACKET_BUFFER_SIZE;
344     g_inputInfoData->buffer[0].buf = (intptr_t)g_inputBuffer.fd;
345 
346     int32_t errorCode = g_codecObj->CodecQueueInput(g_codecObj, g_handle, g_inputInfoData,
347         static_cast<uint32_t>(QUEUE_TIME_OUT), -1);
348     ASSERT_EQ(errorCode, HDF_SUCCESS);
349 }
350 
351 HWTEST_F(CodecProxyTest, HdfCodecHdiV1DequeInputTest_001, TestSize.Level1)
352 {
353     int32_t acquireFd;
354     CodecBuffer *inputInfo = (CodecBuffer *)OsalMemAlloc(sizeof(CodecBuffer) + sizeof(CodecBufferInfo) * 1);
355     ASSERT_TRUE(inputInfo != nullptr);
356     inputInfo->bufferCnt = 1;
357 
358     int32_t errorCode = g_codecObj->CodecDequeueInput(g_codecObj, g_handle, QUEUE_TIME_OUT, &acquireFd, inputInfo);
359     ASSERT_EQ(errorCode, HDF_SUCCESS);
360     ASSERT_EQ(inputInfo->bufferId, g_inputInfoData->bufferId);
361     ASSERT_EQ(inputInfo->bufferCnt, g_inputInfoData->bufferCnt);
362     ASSERT_EQ(inputInfo->buffer[0].type, g_inputInfoData->buffer[0].type);
363     ASSERT_EQ(inputInfo->buffer[0].offset, g_inputInfoData->buffer[0].offset);
364     ASSERT_EQ(inputInfo->buffer[0].length, g_inputInfoData->buffer[0].length);
365     ASSERT_EQ(inputInfo->buffer[0].capacity, g_inputInfoData->buffer[0].capacity);
366     OsalMemFree(inputInfo);
367     OsalMemFree(g_inputInfoData);
368 }
369 
370 HWTEST_F(CodecProxyTest, HdfCodecHdiV1StartCodecTest_001, TestSize.Level1)
371 {
372     int32_t  errorCode = g_codecObj->CodecStart(g_codecObj, g_handle);
373     ASSERT_EQ(errorCode, HDF_SUCCESS);
374 }
375 
376 HWTEST_F(CodecProxyTest, HdfCodecHdiV1StopCodecTest_001, TestSize.Level1)
377 {
378     int32_t errorCode = g_codecObj->CodecStop(g_codecObj, g_handle);
379     ASSERT_EQ(errorCode, HDF_SUCCESS);
380 }
381 
382 HWTEST_F(CodecProxyTest, HdfCodecHdiV1ResetCodecTest_001, TestSize.Level1)
383 {
384     int32_t errorCode = g_codecObj->CodecReset(g_codecObj, g_handle);
385     ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT);
386 }
387 
388 HWTEST_F(CodecProxyTest, HdfCodecHdiV1QueueOutputTest_001, TestSize.Level1)
389 {
390     g_outputBuffer.id = 1;
391     g_outputBuffer.size = TEST_FRAME_BUFFER_SIZE;
392     int32_t ret = CreateFdShareMemory(&g_outputBuffer);
393     ASSERT_EQ(ret, HDF_SUCCESS);
394 
395     g_outputInfoData = (CodecBuffer *)OsalMemAlloc(sizeof(CodecBuffer) + sizeof(CodecBufferInfo) * 1);
396     ASSERT_TRUE(g_outputInfoData != nullptr);
397     g_outputInfoData->bufferId = 1;
398     g_outputInfoData->bufferCnt = 1;
399     g_outputInfoData->flag = 1;
400     g_outputInfoData->timeStamp = 1;
401     g_outputInfoData->buffer[0].type = BUFFER_TYPE_FD;
402     g_outputInfoData->buffer[0].offset = 1;
403     g_outputInfoData->buffer[0].length = 1;
404     g_outputInfoData->buffer[0].capacity = TEST_FRAME_BUFFER_SIZE;
405     g_outputInfoData->buffer[0].buf = (intptr_t)g_outputBuffer.fd;
406 
407     int32_t errorCode = g_codecObj->CodecQueueOutput(g_codecObj, g_handle,
408         g_outputInfoData, static_cast<uint32_t>(0), -1);
409     ASSERT_EQ(errorCode, HDF_SUCCESS);
410 }
411 
412 HWTEST_F(CodecProxyTest, HdfCodecHdiV1DequeueOutputTest_001, TestSize.Level1)
413 {
414     int32_t errorCode = 0;
415     int32_t acquireFd;
416     CodecBuffer *outInfo =
417         reinterpret_cast<CodecBuffer *>(OsalMemAlloc(sizeof(CodecBuffer) + sizeof(CodecBufferInfo) * 1));
418     ASSERT_TRUE(outInfo != nullptr);
419     outInfo->bufferCnt = 1;
420 
421     errorCode = g_codecObj->CodecDequeueOutput(g_codecObj, g_handle, QUEUE_TIME_OUT, &acquireFd, outInfo);
422     ASSERT_EQ(errorCode, HDF_SUCCESS);
423     ASSERT_EQ(outInfo->bufferId, g_outputInfoData->bufferId);
424     ASSERT_EQ(outInfo->bufferCnt, g_outputInfoData->bufferCnt);
425     ASSERT_EQ(outInfo->buffer[0].type, g_outputInfoData->buffer[0].type);
426     ASSERT_EQ(outInfo->buffer[0].offset, g_outputInfoData->buffer[0].offset);
427     ASSERT_EQ(outInfo->buffer[0].length, g_outputInfoData->buffer[0].length);
428     ASSERT_EQ(outInfo->buffer[0].capacity, g_outputInfoData->buffer[0].capacity);
429     OsalMemFree(outInfo);
430     OsalMemFree(g_outputInfoData);
431 }
432 
433 HWTEST_F(CodecProxyTest, HdfCodecHdiV1FlushTest_001, TestSize.Level1)
434 {
435     DirectionType directType = OUTPUT_TYPE;
436 
437     int32_t errorCode = g_codecObj->CodecFlush(g_codecObj, g_handle, directType);
438     ASSERT_EQ(errorCode, HDF_SUCCESS);
439     ASSERT_EQ(directType, OUTPUT_TYPE);
440 }
441 
442 HWTEST_F(CodecProxyTest, HdfCodecHdiV1FlushTest_002, TestSize.Level1)
443 {
444     DirectionType directType = INPUT_TYPE;
445 
446     int32_t errorCode = g_codecObj->CodecFlush(g_codecObj, g_handle, directType);
447     ASSERT_EQ(errorCode, HDF_SUCCESS);
448     ASSERT_EQ(directType, INPUT_TYPE);
449 }
450 
451 HWTEST_F(CodecProxyTest, HdfCodecHdiV1FlushTest_003, TestSize.Level1)
452 {
453     DirectionType directType = ALL_TYPE;
454 
455     int32_t errorCode = g_codecObj->CodecFlush(g_codecObj, g_handle, directType);
456     ASSERT_EQ(errorCode, HDF_SUCCESS);
457     ASSERT_EQ(directType, ALL_TYPE);
458 }
459 
460 HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetCallbackTest_001, TestSize.Level1)
461 {
462     UINTPTR instance = 0;
463     CodecCallback callback;
464     struct CodecCallbackStub *stub = CodecCallbackStubObtain(&callback);
465     ASSERT_TRUE(stub != nullptr);
466 
467     int32_t errorCode = g_codecObj->CodecSetCallback(g_codecObj, g_handle, &stub->service, instance);
468     ASSERT_EQ(errorCode, HDF_SUCCESS);
469 }
470 
471 HWTEST_F(CodecProxyTest, HdfCodecHdiV1DestroyCodecTest_001, TestSize.Level1)
472 {
473     int32_t errorCode = g_codecObj->CodecDestroy(g_codecObj, g_handle);
474     ASSERT_EQ(errorCode, HDF_SUCCESS);
475 }
476 
477 HWTEST_F(CodecProxyTest, HdfCodecHdiV1DeinitTest_001, TestSize.Level1)
478 {
479     int32_t errorCode = g_codecObj->CodecDeinit(g_codecObj);
480     ASSERT_EQ(errorCode, HDF_SUCCESS);
481     HdiCodecRelease(g_codecObj);
482 }
483 }