-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very choppy playback when building MumbleGuiClient #52
Comments
Perhaps try putting some logging into the Audio Decoding Buffer to see if it's running out of samples to play back. |
@martindevans I’m trying to understand the structure of the Audio Decoding Buffer. Should I be logging in Read()? Am I correct in my understanding that that function moves data out of the “decoded buffer”, and effectively “hands it off” to NAudio? |
Yeah basically encoded audio gets dumped into this buffer when it arrives from the network and then the audio devices pulls from it (in |
Is anyone else experiencing this behavior? It would be good to know if the bug is widespread, or if it's just in my build. (For what it's worth, all unit tests passed.) Some logging reveals that even with constant transmission of a stream of noise (blowing into the mic) on another client, the edit: Curiously, it looks like the buffer is sized to be about 1 second long... coincidence? I think not. |
That's definitely the problem then, every time Fixing it ideally requires a jitter buffer (as I described here). A simpler workaround would be to delay the playback of all speech by a fixed amount (say 100ms), to allow the buffer to fill up a bit. |
Do you have any insight as to what an implementation of that delay might look like? I'd be happy to do it. |
I'm afraid I can't remember the details of the playback pipeline (it's been a long time since I wrote this). I'd suggest finding all uses of AudioDecodingBuffer and tracing it out from there. I think that it's implemented as something just reads from that buffer and plays what it gets. In this case what you'd want to do is make the buffer a little more intelligent so you count up writes, and only start returning audio when writes > threshold. As long as reads (happening in realtime) and writes (also happening in realtime) stay in sync you're ok. The tricky bit will be handling when writes stop (due to the remote end stopping transmission), you'll need to detect this case and reset your counter so the buffer has chance to fill up a bit again when they start talking again. |
Thanks for the pointers. After some additional logging and experimentation, it looks like the rate at which the _decodedBuffer fills with network data is considerably slower than the rate at which it's consumed, regardless of whether there is any delay or jitter buffer. If we look at the line where the array _decodedBuffer is defined, we see this: However, if I have the |
Ah, that's a bigger issue than a simple jitter/timing problem! Which application are you using to play back audio (the core MumbleSharp library itself doesn't handle playback iirc)? |
I'm building the MumbleGuiClient example so... NAudio? If I'm understanding your question correctly. |
Also, math error: 5760 is close to 1/8 of 48000 but not quite. It's actually 46080. Maybe not wise to assume a correlation between those two numbers yet. |
So, some notes: I tried implementing a delay by counting writes, but maybe I wasn't doing it very well. Somewhere in this process, I set the quality back to "Normal" (40 kbit/s, 20 ms audio per packet.) I then tried implementing the workaround described in #46. At the "Normal" quality setting, I'm getting good, clear audio! Jitter-free, I think. However, at the "Low" quality setting, I'm getting the behavior I originally described. So, we've now teased out that the source of my woes are actually two separate issues!
I'll open a separate issue for the packet length problem. edit: After more testing, the "High" quality setting works too. Might be the bitrate and not the packet audio length? |
I've implemented a version of the "dynamic" jitter buffer described by kestasjk in #46. My work is in this branch of my fork. This implementation of the "jitter buffer" is contained entirely within It needs more testing, and also some cleanup. I'd love some feedback on the following:
|
|
I appreciate the feedback. I'll try to incorporate these improvements as I continue work on my app. Would you like me to submit a PR for the jitter buffer in it's current state anyway, given that the example apps are unintelligible without it? (And perhaps open a new issue thread for "jitter buffer improvements")? |
Sure, it sounds like it's at least an improvement on what we've got! |
Did this jitter problem get fixed? I am now trying the Gui client and it is very choppy. Text message work fine. |
My trivial jitter buffer was merged in #54, so it should be better. But it doesn’t dynamically scale with latency or anything. There’s a property in AudioEncodingBuffer that should let you adjust the buffer time, maybe play with that? |
What value should be adjusted? jitterMillis? Make it bigger or smaller? |
You’ll want your application to set the value of the JitterDelay property on the AudioDecodingBuffer. Larger values will give you more buffer time, and smoother playback, at the cost of more latency. jitterMillis is overridden by JitterDelay, so don’t modify that directly. |
I am just trying to get two instances of the MumbleGuiClient to talk to each other, the audio is very choppy. I took the JitterDelay up to 800, got a lot of latency, but still didn't get all the voice. Receiving on a standard Mumble client worked fine. |
Hi Robert,
Yep this is a known issue with this software. I have to say in the end when
mumble made a simple change so that you could command mumble to turn
recording on or off by the command line (without dealing with some overkill
"ICE" middleware nonsense) I quickly took the opportunity to drop the
MumbleSharp integration. It's a fine proof of concept or starting point,
but it's a development project not something to take and use.
I could dig up my workaround for the jitter thing, which I vaguely remember
involved temporary halts to let things catch up or some such, but it was
always just a workaround that wouldn't work in a different network
performance context.
The code seemed fine, perfectly understandable, it's just an incomplete
project.
Rgds,
Chris
…On Sat, Jul 4, 2020 at 10:09 AM Robert ***@***.***> wrote:
I am just trying to get two instances of the MumbleGuiClient to talk to
each other, the audio is very choppy.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH2GTOYJ4QAHLQV2NC7SGDRZ2FNTANCNFSM4LERP7WA>
.
|
I have checked the code from the other repo which implementing with unity. I don't understand, in BananaHemic/Mumble-Unity, we just need put the audio buffer into the AudioSource (provided by UnitySDK), then the sound played very smoothly. Is AudioSource doing the jitter buffer work for us implicitly? |
That's a very fair assessment of the state of this project. Everything not to do with voice is pretty solid (text message, channel membership etc) but all the audio stuff is very much in need of more development!
The AudioSource itself is not doing the jitter buffering. Instead that appears to be implemented here - the buffer returns silence until it has got |
Are there any updates on this? I would be interested in helping out. |
Hi,
When building MumbleGuiClient with Visual Studio 2019, I'm getting very choppy playback. I would estimate it at a fraction of a second (so maybe a handful of packets at most) followed by silence, ad nauseum. Recording seems to work fine, as other clients are receiving transmissions from MumbleGuiClient loud and clear.
Could this be a severe case of jitter, as in #46, or is this something more extreme? Perhaps an issue with the build?
The text was updated successfully, but these errors were encountered: