Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame receiving hook with member functions #69

Closed
wowaser opened this issue Aug 12, 2021 · 4 comments
Closed

Frame receiving hook with member functions #69

wowaser opened this issue Aug 12, 2021 · 4 comments
Labels
question Further information is requested

Comments

@wowaser
Copy link
Contributor

wowaser commented Aug 12, 2021

Hi.

This issue is similar to #43.

Function

uvgrtp::media_stream::install_receive_hook(void *arg, void (*hook)(void *, uvgrtp::frame::rtp_frame *)) 

provides a way of pulling frames via callback function, but this doesn't work with member functions. The conversion is not provided.

Also, which is the recommended way of getting frames, pulling in a loop, or installing a hook? Hook seems much more convenient.

Thank you.

@wowaser
Copy link
Contributor Author

wowaser commented Aug 12, 2021

Oh, this was already mentioned in #57.. Yikes.

@altonen
Copy link
Collaborator

altonen commented Aug 14, 2021

There's really no recommended way, it just depends on your use case. Kvazzup uses hooking because of the way its filters are implemented but I've also used polling in applications that had a small and simple event loop in the main() function.

@jrsnen
Copy link
Member

jrsnen commented Aug 16, 2021

@wowaser It is possible to use classes with the RTP (unlike the RTCP) in current implementation. You just have to pass the class as a void parameter (arg) and then have the installed function be static where you call the converted arg->function(frame). Kvazzup uvgRTP receiver has an example of this.

C++ API for this will probably come in 2.2 version of uvgRTP.

@jrsnen jrsnen added the question Further information is requested label Aug 23, 2021
@jrsnen
Copy link
Member

jrsnen commented Aug 23, 2021

My view is that with hooks, there is no extra delay or CPU usage compared to pulling, but when using pulling, the code is clearer and easier to synchronize. Make the decision based on which is more important.

I'm closing this since it is already possible to use classes with current RTP API and #57 will bring the C++ API to uvgRTP.

@jrsnen jrsnen closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants