You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently have a second camera in a scene with a script attached that is sending the stream to a SFU server via WHIP. The application works when started and will run indefinitely until I disconnect from the RDP session and reconnect, which causes the Unity Editor to crash.
Here is the code I am using:
usingSystem.Collections;usingSystem.Collections.Generic;usingUnity.WebRTC;usingUnityEngine;usingUnityEngine.Networking;[RequireComponent(typeof(AudioListener))]publicclassWebRTCPublish:MonoBehaviour{publicstringwhipUrl;publicVector2streamResolution;RTCPeerConnectionpeerConnection;MediaStreamTrackvideoTrack;AudioStreamTrackaudioTrack;Cameracam;voidStart(){StartCoroutine(WebRTC.Update());peerConnection=newRTCPeerConnection{OnIceConnectionChange= state =>{// TODO add retry logic if connection failsDebug.Log("Peer Connection: "+state);}};cam=GetComponent<Camera>();videoTrack=cam.CaptureStreamTrack((int)streamResolution.x,(int)streamResolution.y);peerConnection.AddTrack(videoTrack);AudioListeneraudioListener=cam.GetComponent<AudioListener>();audioTrack=newAudioStreamTrack(audioListener){Loopback=true};peerConnection.AddTrack(audioTrack);StartCoroutine(DoWHIP());}privatevoidOnApplicationQuit(){peerConnection.Close();}IEnumeratorDoWHIP(){RTCSessionDescriptionAsyncOperationoffer=peerConnection.CreateOffer();yieldreturnoffer;RTCSessionDescriptionoffDesc=offer.Desc;RTCSetSessionDescriptionAsyncOperationopLocal=peerConnection.SetLocalDescription(refoffDesc);yieldreturnopLocal;stringfilteredSdp="";foreach(stringsdpLineinoffer.Desc.sdp.Split("\r\n")){if(!sdpLine.StartsWith("a=extmap")){filteredSdp+=sdpLine+"\r\n";}}using(UnityWebRequestwww=newUnityWebRequest(whipUrl)){Debug.Log("Connecting to WHIP server on URL: "+whipUrl);www.uploadHandler=newUploadHandlerRaw(System.Text.Encoding.ASCII.GetBytes(filteredSdp));www.downloadHandler=newDownloadHandlerBuffer();www.method=UnityWebRequest.kHttpVerbPOST;www.SetRequestHeader("Content-Type","application/sdp");www.SetRequestHeader("PublishKey","publish");www.SetRequestHeader("StreamName","unity");yieldreturnwww.SendWebRequest();if(www.result!=UnityWebRequest.Result.Success){Debug.Log("Request failed:");Debug.Log(www.error);}else{RTCSessionDescriptionanswer=newRTCSessionDescription{type=RTCSdpType.Answer,sdp=www.downloadHandler.text};RTCSetSessionDescriptionAsyncOperationopRemote=peerConnection.SetRemoteDescription(refanswer);yieldreturnopRemote;if(opRemote.IsError){Debug.Log(opRemote.Error);}}}}}
The text was updated successfully, but these errors were encountered:
Package version
3.0.0-pre.6
Environment
Steps To Reproduce
Current Behavior
Unity Editor crashes when remote desktop connection is opened
Expected Behavior
Unity continues as normal
Anything else?
Running on an AWS g5.xlarge instance.
GPU: Nvidia A10G running Studio Driver Version 560.81
CPU: AMD EPYC 7R32, 2800 Mhz, 2 Core(s), 4 Logical Processor(s)
Crash Logs Stack Trace:
I currently have a second camera in a scene with a script attached that is sending the stream to a SFU server via WHIP. The application works when started and will run indefinitely until I disconnect from the RDP session and reconnect, which causes the Unity Editor to crash.
Here is the code I am using:
The text was updated successfully, but these errors were encountered: