Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

question: External SurfaceAllocator usage #826

Open
angelo-p opened this issue Jan 25, 2018 · 8 comments
Open

question: External SurfaceAllocator usage #826

angelo-p opened this issue Jan 25, 2018 · 8 comments

Comments

@angelo-p
Copy link

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

@xuguangxin
Copy link
Contributor

xuguangxin commented Feb 1, 2018 via email

@angelo-p
Copy link
Author

angelo-p commented Feb 1, 2018

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

@xuguangxin
Copy link
Contributor

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

@angelo-p
Copy link
Author

angelo-p commented Mar 20, 2018 via email

@xuguangxin
Copy link
Contributor

you mean, it double put the surface for you?

@angelo-p
Copy link
Author

angelo-p commented Mar 20, 2018 via email

@angelo-p
Copy link
Author

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
Copy link
Contributor

xuguangxin commented Mar 23, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants