Uploaded July 2025 | Updated September 2026, 1 week ago
And I got the Unity Native audio playback working properly too! The Unity side is now outputting the audio data at the correct rate. Instead of being like 45.5 k-samples per second for 44.1 kHz audio it's now 44.1 as expected.
For how I fixed this it gets a bit insane. The way I designed the IPC mechanism is that it reads all the available audio data as fast as it can and pushes it over to the main process for processing, instead of reading only the needed chunk at the time (which is not possible anymore, because the audio system and its events are in a different process).
Turns out if the audio buffer in Unity's video playback is read all the way to 0, it freaks out and generates a bunch of duplicate audio data that it's not supposed to.
However if I read all the way to leave just 1 sample in... the problems suddenly go away. So if it says it has 1000 samples available and I read 999 and leave 1 in (until more is available)... everything fixes itself.
I essentially need a small "buffer zone" for the buffer.
However it gets worse. Since I saw number 64 of samples pop in the logs, I tried that number.
That number is bad. Leaving 64 samples in the Unity's video audio buffer after reading from it crashes Unity. Every time.
I settled on leaving 8 in, which works fine. I don't know why, but it just does...
The cool part of this is - this might fix some crashes. The previous system would leave whatever number of samples would just line up in the buffer after reading, because it would only read how much it needs at the time.
Meaning if the timings worked out as such that you'd be left with 64 samples in, you'd crash.
The new system works to specifically leave always 8 samples in, so 64 samples should pretty much never happen anymore. So more fixes yay!
And making both video playback engines work with audio perfectly now works too! And libVLC one listens to pause/resume/flush events, to fix desync too so even more yay!
And it only cost me my sanity!
Anyway... I need to cleanup a few more things, but the video rework will be done soon, which is one of the largest remaining tasks (and probably rabbit holes) other than maybe some bugfixes.
Support development at: patreon.com/resonite
Official website: resonite.com
And I got the Unity Native audio playback working properly too! The Unity side is now outputting the audio data at the correct rate. Instead of being like 45.5 k-samples per second for 44.1 kHz audio it's now 44.1 as expected.
For how I fixed this it gets a bit insane. The way I designed the IPC mechanism is that it reads all the available audio data as fast as it can and pushes it over to the main process for processing, instead of reading only the needed chunk at the time (which is not possible anymore, because the audio system and its events are in a different process).
Turns out if the audio buffer in Unity's video playback is read all the way to 0, it freaks out and generates a bunch of duplicate audio data that it's not supposed to.
However if I read all the way to leave just 1 sample in... the problems suddenly go away. So if it says it has 1000 samples available and I read 999 and leave 1 in (until more is available)... everything fixes itself.
I essentially need a small "buffer zone" for the buffer.
However it gets worse. Since I saw number 64 of samples pop in the logs, I tried that number.
That number is bad. Leaving 64 samples in the Unity's video audio buffer after reading from it crashes Unity. Every time.
I settled on leaving 8 in, which works fine. I don't know why, but it just does...
The cool part of this is - this might fix some crashes. The previous system would leave whatever number of samples would just line up in the buffer after reading, because it would only read how much it needs at the time.
Meaning if the timings worked out as such that you'd be left with 64 samples in, you'd crash.
The new system works to specifically leave always 8 samples in, so 64 samples should pretty much never happen anymore. So more fixes yay!
And making both video playback engines work with audio perfectly now works too! And libVLC one listens to pause/resume/flush events, to fix desync too so even more yay!
And it only cost me my sanity!
Anyway... I need to cleanup a few more things, but the video rework will be done soon, which is one of the largest remaining tasks (and probably rabbit holes) other than maybe some bugfixes.
Support development at: patreon.com/resonite
Official website: resonite.com










