WebRTC crash?

Huân Lê-Vương
Thu, 31 Aug 2023 15:37:57 +0000
Plugins

I’m building a plugin to integrate libmediasoupclient into Unreal Engine. It makes use of the Unreal built-in webRTC module. When loading mediasoup device by calling mediasoup::Device::Load(...), Unreal crashes with this report:

Abort signal received

ucrtbase
ucrtbase
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::webrtc_checks_impl::UnreachableCodeReached()
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::webrtc_checks_impl::FatalLog()
UnrealEditor_ShibuChat_Win64_DebugGame!cricket::WebRtcVoiceEngine::Init()
UnrealEditor_ShibuChat_Win64_DebugGame!cricket::CompositeMediaEngine::Init()
UnrealEditor_ShibuChat_Win64_DebugGame!cricket::ChannelManager::Create()
UnrealEditor_ShibuChat_Win64_DebugGame!std::vector<std::unique_ptr<cricket::VoiceChannel,std::default_delete<cricket::VoiceChannel> >,std::allocator<std::unique_ptr<cricket::VoiceChannel,std::default_delete<cricket::VoiceChannel> > > >::erase()
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::Thread::Restart()
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::Thread::QueuedTaskHandler::OnMessage()
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::Thread::Dispatch()
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::Thread::ProcessMessages()
UnrealEditor_ShibuChat_Win64_DebugGame!rtc::Thread::PreRun()
kernel32
ntdll

From which I think cricket::WebRtcVoiceEngine::Init() causes the crash.

This is the function I call to load mediasoup device:

static decltype(auto) CreateAndLoadDevice(const FString& InRtpCapabilityJsonString) noexcept
{
	mediasoupclient::Device device;
	device.Load(nlohmann::json::parse(StringCast<ANSICHAR>(*InRtpCapabilityJsonString).Get()));
	return device;
}

This is the RTP capabilities I use for the input which I get with socket.io.

{
    "codecs":
    [
        {
            "channels": 2,
            "clockRate": 48000,
            "kind": "audio",
            "mimeType": "audio/opus",
            "parameters": {},
            "preferredPayloadType": 100,
            "rtcpFeedback":
            [
                {
                    "parameter": "",
                    "type": "transport-cc"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/VP8",
            "parameters":
            {
                "x-google-start-bitrate": 1000
            },
            "preferredPayloadType": 101,
            "rtcpFeedback":
            [
                {
                    "parameter": "",
                    "type": "nack"
                },
                {
                    "parameter": "pli",
                    "type": "nack"
                },
                {
                    "parameter": "fir",
                    "type": "ccm"
                },
                {
                    "parameter": "",
                    "type": "goog-remb"
                },
                {
                    "parameter": "",
                    "type": "transport-cc"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/rtx",
            "parameters":
            {
                "apt": 101
            },
            "preferredPayloadType": 102,
            "rtcpFeedback": []
        }
    ],
    "headerExtensions":
    [
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 1,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 1,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "direction": "recvonly",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 2,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
        },
        {
            "direction": "recvonly",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 3,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
        },
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 4,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 4,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "direction": "recvonly",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 5,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 5,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 6,
            "uri": "http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 7,
            "uri": "urn:ietf:params:rtp-hdrext:framemarking"
        },
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 10,
            "uri": "urn:ietf:params:rtp-hdrext:ssrc-audio-level"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 11,
            "uri": "urn:3gpp:video-orientation"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 12,
            "uri": "urn:ietf:params:rtp-hdrext:toffset"
        },
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 13,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 13,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time"
        }
    ]
}

I tried to look around in the Pixel Streaming codes but couldn’t find any call of that webRTC function.
Does anyone know what’s going on?

2 posts - 1 participant