Net Stream hiccups at a regular rate


FMOD playbacks some net streams with frequent hiccups and pauses.

As an example: , this plays smooth in chrome, but when played from our application it hiccups and is rather unbearable. To make sure issue is not specific to our application I tried replacing stream from “FMOD SoundSystem\FMOD Studio API Windows\api\core\examples\vs2017\net_stream.vcxproj” with the link from above and issue is present there as well.


[LOG] SystemI::init                            : Initialize version=20209 (128289), maxchannels=32, flags=0x00110004
[LOG] SystemI::setOutputInternal               : Setting output to 'FMOD WASAPI Output'
[LOG] OutputWASAPI::init                       : Mix Format (WAVEFORMATEX): wFormatTag=0xFFFE, nChannels=2, nSamplesPerSec=48000, nAvgBytesPerSec=384000, nBlockAlign=8, wBitsPerSample=32, cbSize=22.
[LOG] OutputWASAPI::init                       : Mix Format (WAVEFORMATEXTENSIBLE): wValidBitsPerSample=32, dwChannelMask=0x00000003, SubFormat=00000003-0000-0010-8000-00AA00389B71.
[LOG] OutputWASAPI::init                       : Output buffer size: 4096 samples, latency: 0.00ms, period: 10.00ms, DSP buffer: 1024 * 4
[LOG] Thread::initThread                       : Init FMOD stream thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFB, Stack Size: 98304, Semaphore: No, Sleep Time: 10, Looping: Yes.
[LOG] Thread::initThread                       : Init FMOD mixer thread. Affinity: 0x4000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: No, Sleep Time: 0, Looping: Yes.
[LOG] SystemI::createSound                     : filename = : mode 02010088
[LOG] SystemI::createSound                     : FMOD_NONBLOCKING specified.  Putting into queue to be opened asynchronously!
[LOG] Thread::initThread                       : Init FMOD nonblocking thread (0). Affinity: 0x4000000000000003, Priority: 0xFFFF7FFC, Stack Size: 114688, Semaphore: Yes, Sleep Time: 0, Looping: Yes.
[LOG] SystemI::createSound                     : setdata soundi = 000001A791770C38 : node = 000001A79EBDC5B0
[LOG] SystemI::createSound                     : add node to async list : head = 000001A7943CBAB8.  list count = 0
[LOG] AsyncThread::threadFunc                  : Starting Asynchronous operation on sound 000001A791770C38
[LOG] SystemI::createSoundInternal             :     Create name='', mode=0x02010088
[LOG] FMOD_OS_Net_Connect                      :     Attempting connection to '[2606:4700:3034::ac43:9a8e]:80'
[LOG] Profile::init                            :     Profiler listening on port: 9264
[ERR] CodecOggVorbis::openInternal             :     failed to open as ogg
[ERR] CodecMIDI::openInternal                  :     'HThd' ID check failed [???d]
[LOG] SystemI::createSoundInternal             :     Stream: name='(null)', format=2, channels=2, frequency=44100, lengthbytes=-1, lengthpcm=-1, pcmblocksize=1152, loopstart=0, loopend=0, mode=0x00000000, channelmask=0x00000000, channelorder=0, peakvolume=0.000000.
[LOG] Thread::initThread                       :     Init FMOD file thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFC, Stack Size: 65536, Semaphore: No, Sleep Time: 10, Looping: Yes.
[LOG] AsyncThread::threadFunc                  : Finished Asynchronous operation on sound 000001A791770C38
[WRN] DSPI::setChannelFormat                   : Ignoring channelmask (deprecated).
[LOG] SoundI::release                          : mp3 (000001A791770C38)
[LOG] SoundI::release                          :     (null) (000001A79469A3E8)
[LOG] Thread::callback                         : FMOD file thread finished.
[LOG] Codec::release                           : Free PCM Buffer
[LOG] Thread::callback                         : FMOD stream thread finished.
[LOG] Thread::callback                         : FMOD mixer thread finished.
[LOG] Profile::disconnectAll                   : Profiler disconnecting all clients
[LOG] SystemI::close                           : Closed.
[LOG] Thread::callback                         : FMOD nonblocking thread (0) finished.

P.S. Our users are complaining about multiple custom stream, but this one appears the most obvious and severely affected by both, frequent hiccups and regular pauses


There are a couple of things that can cause hiccups you are experiencing.

As the sound is being streamed from the internet, depending on the speed will dictate how quickly data is supplied to the buffer. These hiccups occur as there is no new data for the buffer to read. A solution may be increasing the size of the buffer when it is created e.g.

system->setStreamBufferSize(128*1024*4, FMOD_TIMEUNIT_RAWBYTES);

(FMOD API | Core API Reference)
Hope this helps!

Thank you, but this does not affect ‘hickups’, which appear to be momentary deformations of sound once per second (like someone drags a vinyl).

Buffer does somewhat affects pauses (stream being in ‘starving’ state), with buffer 128 * 1024 * 4 pauses happen each 31 second, with 256 * 1024 * 4 buffer pauses happen each 63 seconds. But I suspect that pauses are somehow related to first issue or otherwise are causes by FMOD buffering slower than it plays.