Net Stream hiccups at a regular rate

Hello

FMOD playbacks some net streams with frequent hiccups and pauses.

As an example: http://radio.plaza.one/mp3 , 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.

Logs:

[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 = http://radio.plaza.one/mp3 : 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='http://radio.plaza.one/mp3', 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

Hi,

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.

Thanks for the clarification on the hiccups. If you use the URL provided in the FMOD examples do you still experience the audio distortion?

Yes, tried it again, issue still reproduces if I use this url in “FMOD SoundSystem\FMOD Studio API Windows\api\core\examples\vs2017\net_stream.vcxproj”

P.S. Users reported same problem for:
https://stream.nightride.fm/nightride.mp3 (personally reproed both pasues and distortions, but distortions here are longer, audio is drastically distorted from how it sounds in chrome)
http://server1.chilltrax.com:9000/ (wasn’t able to repro distortions, but it does starve roughlty once per minute, QA reproed both)

Thank you for those URL’s.

FMOD expects icecast streaming servers to send headers in lowercase but certain streams aren’t. Unfortunately, at this time there is no workaround. I have passed this on to our development team to fix and when we solve the issue I will let you know.

Thank you for bringing this to our attention.

Ok, thank you.

1 Like

Hi,

The issue has been fixed and will be available in our next release.

Thank you, will check it, once it is out.

1 Like

Tried 2.02.13 and streams I tried no longer have distortions.
Thank you.

Pauses (starvation) are still there at the same interval of ~40 seconds, it might be a network issue but vlc works fine.

P.S. Fo some reason web docs do not list this revision despite it being available for download.

1 Like

Good to hear it is working! The pauses do sound like network latency.

The revision is mentioned in the list as:

If you have any more questions, please don’t hesitate to ask.