WebRTC - cannot make the Nvidia Hardware encoder to work

Hello,

I’m trying to use the Nvidia hardware-accelerated video encoder in my C++ application which use the WebRTC native API.

I run it with L4T version 32.2.3 on Jetson Nano.

When my application receive a call signal from another peer, I create the peer connection factory with the Nvidia Encoder, I apply the WebRTC SDP offer to my peer connection, and I can see the requested video codec is H264 (which is supported by the nvidia encoder), but when I create the SDP answer the video codec field is not set and I get an error:

failed to set local video description recv parameters.

When I use the WebRTC builtin encoder, everything goes fine, the answer is well set with the h264 values.

My guess is the Nvidia encoder just think the SDP format is not supported.
I believe that because I printed the info of the format provided by the function GetSupportedFormats() in the NvVideoEncoderFactory class :
There is only one element where the name field is well set to “H264” but the parameters are empty.

If I check the same values provided by the webrtc builtin encoder, I can see 4 format H264 with different parameters:

NVIDIA HARDWARE ENCODER:
H264

SOFTWARE ENCODER:
H264
level-asymmetry-allowed 1
packetization-mode 1
profile-level-id 42001f
H264
level-asymmetry-allowed 1
packetization-mode 0
profile-level-id 42001f
H264
level-asymmetry-allowed 1
packetization-mode 1
profile-level-id 42e01f
H264
level-asymmetry-allowed 1
packetization-mode 0
profile-level-id 42e01f

The SDP format comparison check the name but also check the parameters which have to be exactly identical to return true, so if my guess is right, it may need a fix in the supported formats parameters.

note: for my test the caller use H264 codec with packetization mode 1 and profile-level-id 42e01f, It’s also possible that Nvidia encoder doesn’t support this configuration of H264.

Ok after doing some tests with different H264 configurations, I managed to make it work.

It seems that Nvidia H264 encoder only works with packetization-mode=0 and profile-level-id=42e01f, this could be added to the README.