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

Depacketizer for Track #676

Open
paullouisageneau opened this issue Jul 12, 2022 · 10 comments
Open

Depacketizer for Track #676

paullouisageneau opened this issue Jul 12, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@paullouisageneau
Copy link
Owner

It would be useful to introduce a media handler to depacketize the incoming RTP stream, with a jitter buffer to reorder packets and pace reassembled frames.

@Sean-Der
Copy link
Contributor

@paullouisageneau I am going to start working on this.

Do you have any suggestions/rough sketch of an API you would like? I can get a PR together this weekend.

thank you!

@paullouisageneau
Copy link
Owner Author

Thanks! I've no very precise API in mind, I think something like a generic media handler implementing the jitter buffer part, an another one specialized per codec implementing the depacketization part would make sense.

@Sean-Der
Copy link
Contributor

Sean-Der commented Nov 1, 2023

Hey @paullouisageneau I don't know the best way to do this. Can I get some guidance?

I don't see a way I can use RtcpReceivingSession because it is a MediaHandler.

Should I wrote something that allows a MediaHandler to be used as a MediaHandlerElement ?

Then I can contribute a JitterBuffer that is a MediaHandlerElement and chain them.

@paullouisageneau
Copy link
Owner Author

@Sean-Der I've merged #929 which refactors and drastically simplifies media handlers. It should solve this kind of issue, as now everything is a MediaHandlerand you can simply chain MediaHandler instances together. It keeps compatibility with user code as long as it doesn't implement a custom MediaHandler.

The methods are also simpler, taking a vector of messages that may be modified in-place by the handler.

@flying1314
Copy link

Hey @paullouisageneau I don't know the best way to do this. Can I get some guidance?

I don't see a way I can use RtcpReceivingSession because it is a MediaHandler.

Should I wrote something that allows a MediaHandler to be used as a MediaHandlerElement ?

Then I can contribute a JitterBuffer that is a MediaHandlerElement and chain them.

What is the current status of WHEP?@Sean-Der

@singpolyma
Copy link
Contributor

https://github.com/paullouisageneau/libdatachannel/blob/master/include/rtc/rtpdepacketizer.hpp is mostly implementing this now, right? One think I'm curious about, once depacketized is it possible to still know what codec is in use so I know where to send it next?

@Sean-Der
Copy link
Contributor

@singpolyma check out my code here Sean-Der/obs-studio@506ecb6

I accept + decode + render in OBS

@singpolyma
Copy link
Contributor

singpolyma commented Mar 27, 2024

@Sean-Der That looks very helpful, thanks! It does look like you're only advertising support for opus though, right? So you can just assume the packets have opus in them. Whereas if you advertise both PCMU and opus one needs some way to know what's actually being send. In the RTP packets we can look at the format number and compare to the rtpmap, but post-depacketize I'm not sure where that data is.

I'm also curious, you're using onFrame instead of onMessage is that a bit more low-level?

@singpolyma
Copy link
Contributor

Answered some of my own questions and opened #1156 which I think is needed for codec detection.

@Sean-Der
Copy link
Contributor

Sorry I missed this @singpolyma! I get so many GitHub notifications I tend to ignore them :/

I am on the discord instance, happy to chat anytime :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants