Unity-Technologies / Unity-Technologies/com.unity.webrtc

[BUG]: H264 Main and H265 codecs not detected

Open
#980 2 comments 1 reaction 1 assignee View on GitHub

@karasusan is already working on this.

Since Sep 21, 2023.

bug
Dominant language
Assembly
Stars
852
Forks
238
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.