How to determine which encode handler encoding finished

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to determine which encode handler encoding finished

ソリューションへジャンプ
2,097件の閲覧回数
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,683件の閲覧回数
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,683件の閲覧回数
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,684件の閲覧回数
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,683件の閲覧回数
chunfengzhang
Contributor I

Thanks . I got it.

0 件の賞賛
返信