haiyangwu / mediasoup-client-android

mediasoup android client side library https://mediasoup.org
MIT License
178 stars 107 forks source link

H.264 encoder support #76

Open neilyoung opened 1 year ago

neilyoung commented 1 year ago

Thanks for making and sharing this nice lib. Well done and nice to read.

One question: My Android device supports H.264 hardware encoding. How can I make use of it? I was trying to set the "codec" parameter as I do in my JS realisation, but this seems to not be sufficient.

In my own apps using Google WebRTC directly I recall to have been forced to see some "PeerConnectionOptions" in order to support H.264 hardware codecs. How can this be done with the lib (w/o being forced to build libwebrtc from scratch)?

TIA

neilyoung commented 1 year ago

Additional info:

In PeerConnectionUtils: This is what my encoderFactory provides as supportedCodecs:

image

So something is missing...

neilyoung commented 1 year ago

Same device, other application (based on libwebrtc M105, but I'm sure, H.264 hardware baseline support was already available with M94):

image

I already tried to set the "highProfileSupport" flag to false in order to gain at least baseline support to no avail.

neilyoung commented 1 year ago

OK, removed the libwebrtc.aar from your package and replaced it with mine.

Now there should be also in the mediasoup landscape possible access to H.264 baseline HW codecs

image

To be continued

neilyoung commented 1 year ago

Hmm. I think I need some insight

This is what I get from encoderFactory.supportedCodecs() (just H.264 shown):

image

I'm trying to favour this H.264 (this kind of setup works in JS):

image image

EDIT: Meanwhile I found I have to provide the profile-level-id as string, not as hex number. But this doesn't change the output: No matching codec found

EDIT2: I also found some typos, but those didn't change the outcome ("level-asymmetry-allowed")

neilyoung commented 1 year ago

This has been finally revealed w/o solution:

https://mediasoup.discourse.group/t/is-this-here-also-the-place-to-discuss-android-mediasoup-things/5266/13

koxiong commented 5 months ago

Author

hi neilyoung, do you have resolve the h264 issue? the link https://mediasoup.discourse.group/t/is-this-here-also-the-place-to-discuss-android-mediasoup-things/5266/13 can not visit now

YatinGarg07 commented 5 months ago

Is mediasoup library actively maintained and can is it a prospective server for scaling, rtp and transcoding with users upto 10 in a room?

neilyoung commented 5 months ago

Author

hi neilyoung, do you have resolve the h264 issue? the link https://mediasoup.discourse.group/t/is-this-here-also-the-place-to-discuss-android-mediasoup-things/5266/13 can not visit now

I think yes, but finally it was not only done with this part mentioned. I rolled my own mediasoup lib from a fork and also replaced libwebrtc with a more recent version. In the end H.264 worked, even with simulcast (but software encoder only, libwebrtc does something weird with hardware encoded H.264 and simulcast).

neilyoung commented 5 months ago

Is mediasoup library actively maintained and can is it a prospective server for scaling, rtp and transcoding with users upto 10 in a room?

I think it is no longer actively maintained. Regarding your question: The mediasoup library is a client library for Android, organizing the signaling and media transfer to and from a Mediasoup server instance. Transcoding is not a task for this lib and IMHO also not the RTP for which it is using libwebrtc to my knowledge. The distribution to 10 or more users is task of the Mediasoup server's SFU functionality.