How to determine which encode handler encoding finished

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to determine which encode handler encoding finished

跳至解决方案
1,515 次查看
chunfengzhang
Contributor I

Dear All:

We are going to use VPU on imx6s to Encode two way video streams concurrently.

Currently I'm reading the VPU_API_RM_L3.0.35_1.1.0.pdf. And I have a question. There seems to be a API named vpu_IsBusy(). It seems I can use this API to determine whether one frame has been encoded finished. But I don't know how to determine  the frame in which stream has been encoded finished.

标签 (3)
标记 (1)
0 项奖励
回复
1 解答
1,101 次查看
juangutierrez
NXP Employee
NXP Employee

Hi


Here is the feedback provided by the vpu experrts


  • (1) About vpu_EncStartOneFrame()

There is one lock in vpu driver,  and it will be only occupied by one instance, this API will be blocked until the lock free(or released by other instance).

The lock release operation is located in vpu_EncGetOutputInfo().

  • (2) In general, we recommend customer to use vpu_WaitForInt (blocked API) instead of vpu_IsBusy(polling API)

Sample code like below whose timeout threshold is set with 500*4=2000 ms.

Vpu_EncStartOneFrame();

while(0!=vpu_WaitForInt(500)) {

busy_cnt++;

if(busy_cnt>= 4){

VPU_ENC_ERROR("while: wait busy : time out : count: %d \r\n",(UINT32)busy_cnt);

vpu_SWReset(handle,0);

vpu_EncClose();

Return -1; //time out for some corrupt clips

}

}

Vpu_EncGetOutputInfo();

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,101 次查看
juangutierrez
NXP Employee
NXP Employee

Usually the encoder flow is

vpu_EncStartOneFrame(handle, ...)

vpu_IsBusy()

vpu_EncGetOutputInfo( handle, ...)

Returning from vpu_EncStartOneFrame means that encoding of one frame successfully has initiated.

So, my guess is that even when calling vpu_EncStartOneFrame from different process this will return only until the encoding of the frame of that particular handle has been started. Not sure, if when two process call it at the same time one will return success and the other an error, so you need to retry, or in both process they return success at the proper serialized time.

I will check the latter with one of the vpu experts, and let you know.

0 项奖励
回复
1,102 次查看
juangutierrez
NXP Employee
NXP Employee

Hi


Here is the feedback provided by the vpu experrts


  • (1) About vpu_EncStartOneFrame()

There is one lock in vpu driver,  and it will be only occupied by one instance, this API will be blocked until the lock free(or released by other instance).

The lock release operation is located in vpu_EncGetOutputInfo().

  • (2) In general, we recommend customer to use vpu_WaitForInt (blocked API) instead of vpu_IsBusy(polling API)

Sample code like below whose timeout threshold is set with 500*4=2000 ms.

Vpu_EncStartOneFrame();

while(0!=vpu_WaitForInt(500)) {

busy_cnt++;

if(busy_cnt>= 4){

VPU_ENC_ERROR("while: wait busy : time out : count: %d \r\n",(UINT32)busy_cnt);

vpu_SWReset(handle,0);

vpu_EncClose();

Return -1; //time out for some corrupt clips

}

}

Vpu_EncGetOutputInfo();

0 项奖励
回复
1,101 次查看
chunfengzhang
Contributor I

Thanks . I got it.

0 项奖励
回复