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.
已解决! 转到解答。
Hi
Here is the feedback provided by the vpu experrts
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().
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();
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.
Hi
Here is the feedback provided by the vpu experrts
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().
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();