intel / libyami

Yet Another Media Infrastructure. it is core part of media codec with hardware acceleration, it is yummy to your video experience on Linux like platform.
Apache License 2.0
147 stars 106 forks source link

question: External SurfaceAllocator usage #826

Open angelo-p opened 6 years ago

angelo-p commented 6 years ago

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

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

xuguangxin commented 6 years ago

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:notifications@github.com] Sent: Friday, January 26, 2018 4:07 AM To: intel/libyami libyami@noreply.github.com Cc: Subscribed subscribed@noreply.github.com 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.

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.

angelo-p commented 6 years ago

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

xuguangxin commented 6 years ago

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

angelo-p commented 6 years ago

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 notifications@github.com 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.

xuguangxin commented 6 years ago

you mean, it double put the surface for you?

angelo-p commented 6 years ago

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 notifications@github.com 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 commented 6 years ago

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.

xuguangxin commented 6 years ago

@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.