Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
755 stars 196 forks source link

[BUG]: Crash when building for Dedicated Server (Linux and Windows) #753

Open KlingOne opened 2 years ago

KlingOne commented 2 years ago

Package version

2.4.0-exp.7

Environment

* OS:Windows and Linux
* Unity version:2021.3.3f1

Steps To Reproduce

Build and the VideoReceive Sample with Dedicated Server as build Target (Windows or Linux)

Current Behavior

App Crashes when initializing WebRTC

================================================================= Managed Stacktrace:

      at <unknown> <0xffffffff>
      at Unity.WebRTC.NativeMethods:ContextCreate <0x00089>
      at Unity.WebRTC.Context:Create <0x00022>
      at Unity.WebRTC.WebRTC:Initialize <0x0015a>
      at Unity.WebRTC.Samples.VideoReceiveSample:Awake <0x00042>
      at System.Object:runtime_invoke_void__this__ <0x00087>

================================================================= Crash!!!

========== OUTPUTTING STACK TRACE ==================

0x00007FFBC8690B30 (webrtc) GetUpdateTextureFunc 0x00007FFBC867F1BC (webrtc) GetUpdateTextureFunc 0x00007FFBC867EDCA (webrtc) GetUpdateTextureFunc 0x0000019D99620C3A (Mono JIT Code) (wrapper managed-to-native) Unity.WebRTC.NativeMethods:ContextCreate (int) 0x0000019D99620AF3 (Mono JIT Code) Unity.WebRTC.Context:Create (int) 0x0000019D9962015B (Mono JIT Code) Unity.WebRTC.WebRTC:Initialize (bool,bool,Unity.WebRTC.NativeLoggingSeverity) 0x0000019D9961F3B3 (Mono JIT Code) Unity.WebRTC.Samples.VideoReceiveSample:Awake () 0x0000019D3829D088 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_voidthis (object,intptr,intptr,intptr) 0x00007FFC133FE0A4 (mono-2.0-bdwgc) mono_jit_set_domain 0x00007FFC1333E744 (mono-2.0-bdwgc) mono_object_get_virtual_method 0x00007FFC1333E8DC (mono-2.0-bdwgc) mono_runtime_invoke

Expected Behavior

App does not crash

Anything else?

This used to worked on 2.4.0-exp.4

karasusan commented 2 years ago

We have not supported dedicated server platform yet, but the app crashes is weird. I think the dedicated server don't have the video/audio rendering feature.

@KlingOne Is it related your issue? https://github.com/Unity-Technologies/com.unity.webrtc/issues/734

kannan-xiao4 commented 2 years ago

memo: WRS-348

KlingOne commented 2 years ago

@karasusan I don't think so. For me the samples work fine in the editor and in standalone builds. Only when building as Dedicated Server the crash occurs. I also tried the develop brach with #741 and the error still persists.

But the problem could be similar, since Dedicated Server builds do not initialize a graphics device at all as far as I know.

karasusan commented 2 years ago

@KlingOne Sure. I will check it on the platform. I am curious how you use it on the Dedicated server.

KlingOne commented 2 years ago

@karasusan We are using the dedicated server as signaling server so that every player that joins our game automatically gets added to a WebRTC group call

karasusan commented 2 years ago

@KlingOne This is only my opinion, I think websocket is better than webrtc for signaling server.

KlingOne commented 2 years ago

@KlingOne For sure. But for us it was the fastest way to implement it since the Server was allready up and running.

I still wanted to let you know about the crash.

karasusan commented 2 years ago

@KlingOne We added the ticket for the issue into our backlog, but I cannot promise when it will be fixed.

jonkelling commented 2 years ago

We are seeing this problem as well. Not using a dedicated server build. It will crash when calling WebRTC.Initialize();, and this happens when trying to run inside the Unity editor.


========== OUTPUTTING STACK TRACE ==================

0x00007FF976AF4FD9 (KERNELBASE) RaiseException
0x00007FF8DC4D4CF8 (webrtc) GetUpdateTextureFunc
0x00007FF8DBBD4277 (webrtc) GetUpdateTextureFunc
0x00007FF8DBBD100A (webrtc) GetUpdateTextureFunc
0x00007FF8DBBAFB0E (webrtc) GetUpdateTextureFunc
0x00007FF8DBBB19E4 (webrtc) GetUpdateTextureFunc
0x00007FF8DBBA06BB (webrtc) GetUpdateTextureFunc
0x00007FF8DBB91065 (webrtc) GetUpdateTextureFunc
0x00007FF8DBB80FE0 (webrtc) GetUpdateTextureFunc
0x00007FF8DBB7FAFA (webrtc) GetUpdateTextureFunc
0x00007FF8DBB73496 (webrtc) ContextCreate
0x0000024FEEF8878A (Mono JIT Code) (wrapper managed-to-native) Unity.WebRTC.NativeMethods:ContextCreate (int)
0x0000024FEEF88643 (Mono JIT Code) [D:\Breach Code\Library\PackageCache\com.unity.webrtc@2.4.0-exp.8\Runtime\Scripts\Context.cs:18] Unity.WebRTC.Context:Create (int) 
0x0000024FEEF880C3 (Mono JIT Code) [D:\Breach Code\Library\PackageCache\com.unity.webrtc@2.4.0-exp.8\Runtime\Scripts\WebRTC.cs:367] Unity.WebRTC.WebRTC:Initialize (bool,bool,Unity.WebRTC.NativeLoggingSeverity) ```
kannan-xiao4 commented 2 years ago

@jonkelling Thanks for reporting your situation. Can you share your environment ( platform, WebRTC package version, Unity Editor version) or Editor.log ?