Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
738 stars 185 forks source link

[BUG]: H264 Main and H265 codecs not detected #980

Open FabienDanieau opened 9 months ago

FabienDanieau commented 9 months ago

Package version

3.0.0-pre.6

Environment

* OS: Android - Oculus Quest 2
* Unity version: Unity 2020.3.48f1

Steps To Reproduce

Adapting the code from AudioSample.cs, I wanted to display the available codecs on the Oculus Quest 2

Basically I call this

    static string CodecToOptionName(RTCRtpCodecCapability cap)
    {
        return string.Format($"{cap.mimeType} " +
            $"{cap.clockRate} " +
            $"channel={cap.channels}" + $"sdpFmtpLine={cap.sdpFmtpLine}");
    }

in a webrtc call

protected override void WebRTCCall()
    {
        _receiveStream = new MediaStream();
        _receiveStream.OnAddTrack += OnAddTrack;
        if (_pc != null)
        {
            _pc.OnTrack = (evt) =>
            {
                Debug.Log($"[WebRTC] OnTrack {evt.Track} id: {evt.Track.Id}");

                if (evt.Track.Kind == TrackKind.Video)
                {
                    _receiveStream.AddTrack(evt.Track);

                    var codecs = RTCRtpSender.GetCapabilities(TrackKind.Video).codecs;

                    List<RTCRtpCodecCapability> availableCodecs = new List<RTCRtpCodecCapability>();
                    foreach (var codec in codecs)
                    {
                        Debug.LogError(CodecToOptionName(codec));
                    }

...
}

Current Behavior

The following codecs are found: 09-21 14:48:40.001 14697 14722 E Unity : video/VP8 90000 channel=sdpFmtpLine=implementation_name=Internal 09-21 14:48:40.001 14697 14722 E Unity : video/rtx 90000 channel=sdpFmtpLine= 09-21 14:48:40.002 14697 14722 E Unity : video/VP8 90000 channel=sdpFmtpLine=implementation_name=MediaCodec 09-21 14:48:40.003 14697 14722 E Unity : video/VP9 90000 channel=sdpFmtpLine=implementation_name=Internal;profile-id=0 09-21 14:48:40.003 14697 14722 E Unity : video/H264 90000 channel=sdpFmtpLine=implementation_name=MediaCodec;level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f 09-21 14:48:40.004 14697 14722 E Unity : video/AV1 90000 channel=sdpFmtpLine=implementation_name=Internal 09-21 14:48:40.005 14697 14722 E Unity : video/red 90000 channel=sdpFmtpLine= 09-21 14:48:40.005 14697 14722 E Unity : video/ulpfec 90000 channel=sdpFmtpLine=

Expected Behavior

I only see the h264 baseline profile, although the h264 main and h265 should be supported by Android and Oculus Quest

Am I missing something here?

Thanks

Anything else?

No response

FabienDanieau commented 8 months ago

Looks related to #838