BananaHemic / Mumble-Unity

Performant Mumble Client For Unity3D
MIT License
79 stars 30 forks source link

Empty or wrong sized packet Error #20

Closed JetroD closed 6 years ago

JetroD commented 6 years ago

Hi, I 'm having a error with this project. I downloaded it in an empty Unity project, loaded the Example Scene and modified the Mumble Host Name. When I hit play, the library connects to the server, but fails when trying to decode the sound of participants in the room. I can see small points on Editor Graph but i can't hear anything.

The first error in UnityConsole is:

Parameter name: outputChannelCount
Mumble.OpusDecoder..ctor (Int32 outputSampleRate, Int32 outputChannelCount) (at Assets/Mumble-Unity/Scripts/Opus/OpusDecoder.cs:59)

This is the Error each time the asset try to decode audio:

UnityEngine.Debug:LogError(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:150)
Mumble.MumbleTcpConnection:ProcessTcpData() (at Assets/Mumble-Unity/Scripts/MumbleTCPConnection.cs:254) 

Am I doing something wrong? Is this behaviour normal? Any ideas to fix this?

BananaHemic commented 6 years ago

That's definitely not normal behaviour. Where are the audio packets coming from? Have you set the mumble server to only allow Opus?

JetroD commented 6 years ago

Thanks for your fast response.

We have a Mumble server version 1.2.19 on Ubuntu 18.04 and with only allow Opus. We are using the last Unity version 2018.2.

BananaHemic commented 6 years ago

Is the audio sender another Mumble-Unity, or is it a mumble application? If the latter, which platform?

JetroD commented 6 years ago

We try using a mac with the mumble application and an Android 8.1 tablet with pluble app too.

BananaHemic commented 6 years ago

Could you try setting ConnectAsyncronously to true in MumbleTester if it isn't currently true? I think the first error is because the you end up connecting before the channel count is retrieved. If that still doesn't work, can you try moving the lines 104-110 in MumbleClient to the end of the constructor?

JetroD commented 6 years ago

Yes connectAsyncronously is true and I moved the lines but this is still not works. But the first error had disappeared, the second is still going.

UnityEngine.Debug:LogError(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:149)
Mumble.MumbleUdpConnection:ProcessUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:94)
Mumble.MumbleUdpConnection:ReceiveUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:64)
Mumble.MumbleUdpConnection:ReceiveUdpMessage(IAsyncResult) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:72)
System.Net.Sockets.Worker:ReceiveFrom()

Any ideas?

BananaHemic commented 6 years ago

Unfortunately I don't really have a lot of theories about what's going on. Could you change the log in the second error to be: Debug.LogError("empty or wrong sized packet. Recv: " + (data != null ? data.Length.ToString() : "null") + " expected: " + size) And then let me know what it is?

JetroD commented 6 years ago

This is the result:

empty or wrong sized packet. Recv: null expected: 2969
UnityEngine.Debug:LogError(Object)

The size grows continually until ~8200 then, bad codified noise is heard and one second after, the error reappear with the size count at ~100.

BananaHemic commented 6 years ago

Ok, that size is definitely wrong, as I generally get about 97. I'm not sure what would cause the size value that you get to be so different.

Sorry to give you so many questions, I just don't have any way to reproduce the issue. Could you try un-commenting the logs in UnpackOpusVoicePacket and ProcessUdpMessage and attaching the full output log? Are you on 32 or 64 bit? What happens when you turn on UseLocalLoopBack?

JetroD commented 6 years ago

64 bit System and here the logs:

empty or wrong sized packet. Recv: null expected: 3989
UnityEngine.Debug:LogError(Object)

encrypted length: 110
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:ProcessUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:76)

237 33
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:ProcessUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:78)

UDP response received: 10000000
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:ProcessUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:86)

UDP response type: Opus
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:ProcessUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:87)

UDP length: 106
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:ProcessUdpMessage(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:88)

len = 106 typeByte = 128
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:120)

Seq = 14 Ses: 16 Size 36759 type= 128 tar= 0
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:135)

Received sess: 16
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:143)

 seq: 14 size = 3991 packetLen: 106
UnityEngine.Debug:Log(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:144)

empty or wrong sized packet. Recv: null expected: 3991
UnityEngine.Debug:LogError(Object)
Mumble.MumbleUdpConnection:UnpackOpusVoicePacket(Byte[]) (at Assets/Mumble-Unity/Scripts/MumbleUDPConnection.cs:150)

Thanks

BananaHemic commented 6 years ago

Ok, I think I fixed the issue you were experiencing. I believe that you had local loopback on, which caused the audio packets sent by the server from other users to be read incorrectly (because server-sent audio messages are formatted slightly differently then client-sent). The local loopback was only built for debugging, so it wasn't tested to work with a real server connection. I also disabled the local loopback by default in the example scene.

JetroD commented 6 years ago

It works!, thanks for your time. I tested making the varibale UserLocalLoopback on MumbleClient.cs to false and it works!