ossrs / srs-unity

WebRTC Samples with SRS SFU server for Unity.
https://ossrs.io
MIT License
72 stars 10 forks source link

WebRTC: Exchange SDP failed #13

Open Kane9527 opened 1 year ago

Kane9527 commented 1 year ago

SDP negotiation failed! The local SRS service uses SRS-Windows-x86_64-5.0-b3-setup and Docker has been tried, the configuration is rtc2rtmp.conf This is the case from Unity 19 to 22, com.unity.webrtc@3.0.0-pre.1~5 and 2.4 are also the same, I see the error is in this part of the code, image Because there is an RTSP camera, it also pushes to the SRS service, but when pulling the stream, some computers also report this error, while some computers work well, which is very strange. 请问如何解决?是哪里出了问题? image

image

WebRTC: Exchange SDP failed, url=http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream, err is System.AggregateException: One or more errors occurred. (An error occurred while sending the request) ---> System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDoneAsync2): ReceiveFailure at System.Net.WebResponseStream.InitReadAsync (System.Threading.CancellationToken cancellationToken) [0x000f3] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.WebOperation.Run () [0x001d9] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x00094] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00020] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <6073cf49ed704e958b8a66d540dea948>:0 --- End of stack trace from previous location where exception was thrown ---

at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x004ae] in <8ab5a610e55c46a3a47ee18acfd3668c>:0 --- End of inner exception stack trace --- at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00509] in <8ab5a610e55c46a3a47ee18acfd3668c>:0 at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <8ab5a610e55c46a3a47ee18acfd3668c>:0 at SrsStreamer+<>c__DisplayClass10_0.b__11 () [0x00073] in C:\Users\Kane\Desktop\srs-unity\Assets\ossrs.io\Video Streaming and WebRTC Samples\Streamer\SrsStreamer.cs:173 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDoneAsync2): ReceiveFailure at System.Net.WebResponseStream.InitReadAsync (System.Threading.CancellationToken cancellationToken) [0x000f3] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.WebOperation.Run () [0x001d9] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x00094] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0 at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <6d7c4c8dd3624dc596686fb7270ae1e6>:0

TRANS_BY_GPT4

guangyongalone commented 11 months ago

Have you solved this problem?

RichardsATcn commented 5 months ago

Encountered the same issue with Unity 2022.3.31f1 + WebRTC 3.0.0.pre7 + SRS Release v5.0-r2.

WebRTC: Exchange SDP failed, url=http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream, err is System.AggregateException: One or more errors occurred. (An error occurred while sending the request) ---> System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDoneAsync2): ReceiveFailure at System.Net.WebResponseStream.InitReadAsync (System.Threading.CancellationToken cancellationToken) [0x000f3] in :0 at System.Net.WebOperation.Run () [0x001d9] in :0 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x00094] in <e2bec1e2c81b42b3b2ee8a58b12808fc>:0 at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <e2bec1e2c81b42b3b2ee8a58b12808fc>:0 at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00020] in <e2bec1e2c81b42b3b2ee8a58b12808fc>:0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <467a840a914a47078e4ae9b0b1e8779e>:0 --- End of stack trace from previous location where exception was thrown ---

at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x004ae] in <7525edf6bbaf4eada243526d1f860b91>:0 --- End of inner exception stack trace --- at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00509] in <7525edf6bbaf4eada243526d1f860b91>:0 at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <7525edf6bbaf4eada243526d1f860b91>:0 at SrsPublisher+<>c__DisplayClass9_0.b__11 () [0x00073] in E:\Project_JY\TestWebRTC\Assets\io.ossrs\Samples\Publisher\SrsPublisher.cs:199 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDoneAsync2): ReceiveFailure at System.Net.WebResponseStream.InitReadAsync (System.Threading.CancellationToken cancellationToken) [0x000f3] in :0 at System.Net.WebOperation.Run () [0x001d9] in :0 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x00094] in <e2bec1e2c81b42b3b2ee8a58b12808fc>:0 at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <e2bec1e2c81b42b3b2ee8a58b12808fc>:0 at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00020] in <e2bec1e2c81b42b3b2ee8a58b12808fc>:0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <467a840a914a47078e4ae9b0b1e8779e>:0 --- End of stack trace from previous location where exception was thrown ---

at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x004ae] in <7525edf6bbaf4eada243526d1f860b91>:0 --- End of inner exception stack trace --- at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00509] in <7525edf6bbaf4eada243526d1f860b91>:0 at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <7525edf6bbaf4eada243526d1f860b91>:0 at SrsPublisher+<>c__DisplayClass9_0.b__11 () [0x00073] in E:\Project_JY\TestWebRTC\Assets\io.ossrs\Samples\Publisher\SrsPublisher.cs:199 <---

UnityEngine.Debug:Log (object) SrsPublisher/<g__ExchangeSDP|9_8>d:MoveNext () (at Assets/io.ossrs/Samples/Publisher/SrsPublisher.cs:212) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr) image image

TRANS_BY_GPT4

Darker-JCG commented 3 months ago

你们有解决这个问题么,我推流也是这个问题,通过SRS的whip是正常能推的,到这边来就不能推了

price6856 commented 2 months ago

同问,有没有解决方法