libyami icon indicating copy to clipboard operation
libyami copied to clipboard

question: External SurfaceAllocator usage

Open angelo-p opened this issue 7 years ago • 8 comments

Hello, When I setup libyami for an external SurfaceAllocator usage, user-code gets an "alloc: and "free" function callbacks.

  • the alloc callback is used by the lib to get all of the user provided surfaces
  • the free callback is used by the lib to let the user cleanup all the surfaces.

When decoding a specific frame, is there a mechanism in place that would let the lib query user-code for the surface to be used as the current rendering target ?

Thanks for your input, Angelo

angelo-p avatar Jan 25 '18 20:01 angelo-p

Hi Angelo: Do you want choose which surface to decode to ? You can refer to https://github.com/intel/libyami/blob/apache/v4l2/v4l2_decode.cpp#L210 for get/put API

From: angelo-p [mailto:[email protected]] Sent: Friday, January 26, 2018 4:07 AM To: intel/libyami [email protected] Cc: Subscribed [email protected] Subject: [intel/libyami] question: External SurfaceAllocator usage (#826)

Hello, When I setup libyami for an external SurfaceAllocator usage, user-code gets an "alloc: and "free" function callbacks.

  • the alloc callback is used by the lib to get all of the user provided surfaces
  • the free callback is used by the lib to let the user cleanup all the surfaces.

When decoding a specific frame, is there a mechanism in place that would let the lib query user-code for the surface to be used as the current rendering target ?

Thanks for your input, Angelo

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/intel/libyami/issues/826, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGW9GicfJJheeldEhKqqAXmnG0zkyhw_ks5tON7SgaJpZM4Rtafk.

xuguangxin avatar Feb 01 '18 13:02 xuguangxin

Yes, I take a look. Thanks a lot! Angelo

angelo-p avatar Feb 01 '18 14:02 angelo-p

hi @angelo-p , is it working for you?

xuguangxin avatar Mar 20 '18 14:03 xuguangxin

Hi Xu Guangxin,

Yes, it is working but I am looking into a problem that occurs when flushing.

when I call decodeFlush(), my surface_do_put_callback() callback get calls with surfaces that are hold in the decoder DPB but also with surfaces that have already been released.

Angelo


From: Xu Guangxin [email protected] Sent: March 20, 2018 10:52 AM To: intel/libyami Cc: angelo-p; Mention Subject: Re: [intel/libyami] question: External SurfaceAllocator usage (#826)

hi @angelo-phttps://github.com/angelo-p , is it working for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/intel/libyami/issues/826#issuecomment-374626857, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AbYsBzLZwN-ChHGj3I3HjvOisXmOaheTks5tgReygaJpZM4Rtafk.

angelo-p avatar Mar 20 '18 15:03 angelo-p

you mean, it double put the surface for you?

xuguangxin avatar Mar 20 '18 15:03 xuguangxin

No, it doesn't.

When my code is getting a decoded VideoFrame *ovp through a call to decodeGetOutput(), I call ovf->free(ovf) on it when done processing.

That ovf->free(ovf) call doesn't trigger the put callback to be exercised.

This behavior causes housekeeping of what need to be released on flush difficult.

Angelo


From: Xu Guangxin [email protected] Sent: March 20, 2018 11:04 AM To: intel/libyami Cc: angelo-p; Mention Subject: Re: [intel/libyami] question: External SurfaceAllocator usage (#826)

you mean, it double put the surface for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/intel/libyami/issues/826#issuecomment-374631571, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AbYsBzTkTEu6NXCzavOc4uQzLPMUiyYwks5tgRp2gaJpZM4Rtafk.

angelo-p avatar Mar 20 '18 15:03 angelo-p

Thanks for you comments Xu Guangxin. your previous question: 'you mean, it double put the surface for you?' made me realize that I was mishandling the flushing of the libyami surface in the put callback.

angelo-p avatar Mar 22 '18 19:03 angelo-p

@angelo-p , the function name may be misleading, the free only decrease the reference count for the frame. For the outputted frame, decoder still needs it as a reference frame for future decoding. So when you call get output, the frame's reference count is 2, one is for the decoder, one is for you. After you did render, you call free, the reference count drops to 1. When you call flush, the reference count will drop to 0, the put function will be called to indicate the frame returned to you.

xuguangxin avatar Mar 23 '18 01:03 xuguangxin