Answered
0
0

Hi,

This is a iOS only issue, the same code works fine on Mac OS X.

Expected result:
mp3 plays.

Current result:
FMOD 5 failed to play the mp3 stream with error code FMOD_ERROR_FILE_COULDNOTSEEK.

Here is the modified net_stream example which should reproduce the issue.
http://pastebin.ca/3194770

any hint?

== log ==

[LOG] SystemI::init                            : FMOD Studio Version: 00010700 (68517)
[LOG] SystemI::init                            : maxchannels = 1, flags = 00000000, extradriverdata = 0x0
[LOG] SystemI::close                           : 
[LOG] SystemI::close                           : Stop all sounds
[LOG] SystemI::close                           : Remove miscllaneous DSP stuff.
[LOG] SystemI::close                           : done.

[WRN] OutputCoreAudio::init                    : DSP buffer size * DSP num buffers is potentially too small.
[LOG] OutputCoreAudio::init                    : Maximum hardware read size: 4096 samples, Software buffer size: 512 samples, Number of software buffers: 4.
[LOG] OutputCoreAudio::init                    : Hardware buffer size: 557 samples, hardware sample rate: 44100Hz.
[LOG] Thread::initThread                       : Initializing FMOD mixer thread.  priority 1
[LOG] Thread::initThread                       : - Stacksize 49152.  Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD mixer thread started
[LOG] SystemI::init                            : Set up emulated output
[LOG] SystemI::init                            : create the channel pool
[LOG] SystemI::init                            : Set up streamer
[LOG] Thread::initThread                       : Initializing FMOD stream thread.  priority 2
[LOG] Thread::initThread                       : - Stacksize 65536.  Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
[LOG] Thread::callback                         : * FMOD stream thread started
[LOG] SystemI::createSound                     : filename = http://uploadserver.oss.aliyuncs.com/745/699745/1443431047-55.mp3 : mode 00018080
[LOG] SystemI::createSound                     : FMOD_NONBLOCKING specified.  Putting into queue to be opened asynchronously!
[LOG] Thread::initThread                       : Initializing FMOD nonblocking thread (0).  priority 1
[LOG] Thread::initThread                       : - Stacksize 81920.  Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD nonblocking thread (0) started
[LOG] SystemI::createSound                     : setdata soundi = 0x125d5d668 : node = 0x125d5d820
[LOG] SystemI::createSound                     : add node to async list : head = 0x125d5dab0.  list count = 0
[LOG] AsyncThread::threadFunc                  : Starting Asynchronous operation on sound 0x125d5d668
[LOG] SystemI::createSoundInternal             :     filename = http://uploadserver.oss.aliyuncs.com/745/699745/1443431047-55.mp3 : mode 00018080
[LOG] SystemI::createSoundInternal             :     exinfo->cbsize             = 216
[ERR] CodecFSB5::headerReadCheck               :     Header check failed. Not an FSB5
[ERR] CodecOggVorbis::openInternal             :     failed to open as ogg
[ERR] CodecMIDI::openInternal                  :     'HThd' ID check failed [??p]
[ERR] CodecAudioQueue::setupAudioFile          :     File not supported by this codec.
[LOG] AsyncThread::threadFunc                  : Finished Asynchronous operation on sound 0x125d5d668
  • You must to post comments
Best Answer
1
0

On iOS we provide the AudioQueue codec at a higher priority than our cross-platform MPEG codec to allow hardware assisted decoding. This usually works transparently however in the case of net streams the excessive seeking performed by the AudioQueue codec causes a failure.

To avoid this issues use FMOD_CREATESOUNDEXINFO::suggestSoundType, set it to FMOD_SOUND_TYPE_MPEG and pass the structure into System::createSound. This will tell FMOD to use our cross-platform MPEG decoder instead of AudioQueue (same behavior as on the Mac). Also, don’t forget to set FMOD_CREATESOUNDEXINFO::cbsize to sizeof(FMOD_CREATESOUNDEXINFO).

EDIT:
It looks like you have found a bug where suggestSoundType is being ignored when you have a custom codec. I’ll have a fix in place for our next release.

As a work around, if you lower the priority of your codec to put it at the end of the list suggestedSoundType will work correctly.

  • You must to post comments
0
0

The workaround doesn’t work. If I remove the line which registers the dummy codec, the example works fine even without setting the suggestSoundType to FMOD_SOUND_TYPE_MPEG. From the log bellow you can see that the FMOD 5 still try to open the stream with all codecs one by one, and fails due to audio queue codec performs excessive seeking. Is it possible to remove the audio queue codec from list?

=== log with dummy codec and suggestedsoundtype = FMOD_SOUND_TYPE_MPEG ==

[LOG] SystemI::init                            : FMOD Studio Version: 00010700 (68517)
[LOG] SystemI::init                            : maxchannels = 1, flags = 00000000, extradriverdata = 0x0
[LOG] SystemI::close                           : 
[LOG] SystemI::close                           : Stop all sounds
[LOG] SystemI::close                           : Remove miscllaneous DSP stuff.
[LOG] SystemI::close                           : done.

[WRN] OutputCoreAudio::init                    : DSP buffer size * DSP num buffers is potentially too small.
[LOG] OutputCoreAudio::init                    : Maximum hardware read size: 4096 samples, Software buffer size: 512 samples, Number of software buffers: 4.
[LOG] OutputCoreAudio::init                    : Hardware buffer size: 557 samples, hardware sample rate: 44100Hz.
[LOG] Thread::initThread                       : Initializing FMOD mixer thread.  priority 1
[LOG] Thread::initThread                       : - Stacksize 49152.  Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD mixer thread started
[LOG] SystemI::init                            : Set up emulated output
[LOG] SystemI::init                            : create the channel pool
[LOG] SystemI::init                            : Set up streamer
[LOG] Thread::initThread                       : Initializing FMOD stream thread.  priority 2
[LOG] Thread::initThread                       : - Stacksize 65536.  Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
[LOG] Thread::callback                         : * FMOD stream thread started
[LOG] SystemI::createSound                     : filename = http://uploadserver.oss.aliyuncs.com/745/699745/1443431047-55.mp3 : mode 00010080
[LOG] SystemI::createSound                     : FMOD_NONBLOCKING specified.  Putting into queue to be opened asynchronously!
[LOG] Thread::initThread                       : Initializing FMOD nonblocking thread (0).  priority 1
[LOG] Thread::initThread                       : - Stacksize 81920.  Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD nonblocking thread (0) started
[LOG] SystemI::createSound                     : setdata soundi = 0x13cd56e78 : node = 0x13ce98e20
[LOG] SystemI::createSound                     : add node to async list : head = 0x13ce99100.  list count = 0
[LOG] AsyncThread::threadFunc                  : Starting Asynchronous operation on sound 0x13cd56e78
[LOG] SystemI::createSoundInternal             :     filename = http://uploadserver.oss.aliyuncs.com/745/699745/1443431047-55.mp3 : mode 00010080
[LOG] SystemI::createSoundInternal             :     exinfo->cbsize             = 216
[LOG] SystemI::createSoundInternal             :     exinfo->suggestedsoundtype = 9
[ERR] CodecFSB5::headerReadCheck               :     Header check failed. Not an FSB5
[ERR] CodecOggVorbis::openInternal             :     failed to open as ogg
[ERR] CodecMIDI::openInternal                  :     'HThd' ID check failed [??p]
[ERR] CodecAudioQueue::setupAudioFile          :     File not supported by this codec.
[LOG] AsyncThread::threadFunc                  : Finished Asynchronous operation on sound 0x13cd56e78

=== log with dummy codec removed ===

[LOG] SystemI::init                            : FMOD Studio Version: 00010700 (68517)
[LOG] SystemI::init                            : maxchannels = 1, flags = 00000000, extradriverdata = 0x0
[LOG] SystemI::close                           : 
[LOG] SystemI::close                           : Stop all sounds
[LOG] SystemI::close                           : Remove miscllaneous DSP stuff.
[LOG] SystemI::close                           : done.

[WRN] OutputCoreAudio::init                    : DSP buffer size * DSP num buffers is potentially too small.
[LOG] OutputCoreAudio::init                    : Maximum hardware read size: 4096 samples, Software buffer size: 512 samples, Number of software buffers: 4.
[LOG] OutputCoreAudio::init                    : Hardware buffer size: 557 samples, hardware sample rate: 44100Hz.
[LOG] Thread::initThread                       : Initializing FMOD mixer thread.  priority 1
[LOG] Thread::initThread                       : - Stacksize 49152.  Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD mixer thread started
[LOG] SystemI::init                            : Set up emulated output
[LOG] SystemI::init                            : create the channel pool
[LOG] SystemI::init                            : Set up streamer
[LOG] Thread::initThread                       : Initializing FMOD stream thread.  priority 2
[LOG] Thread::initThread                       : - Stacksize 65536.  Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
[LOG] Thread::callback                         : * FMOD stream thread started
[LOG] SystemI::createSound                     : filename = http://uploadserver.oss.aliyuncs.com/745/699745/1443431047-55.mp3 : mode 00010080
[LOG] SystemI::createSound                     : FMOD_NONBLOCKING specified.  Putting into queue to be opened asynchronously!
[LOG] Thread::initThread                       : Initializing FMOD nonblocking thread (0).  priority 1
[LOG] Thread::initThread                       : - Stacksize 81920.  Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD nonblocking thread (0) started
[LOG] SystemI::createSound                     : setdata soundi = 0x155e9c048 : node = 0x155e9c200
[LOG] SystemI::createSound                     : add node to async list : head = 0x155e9c490.  list count = 0
[LOG] AsyncThread::threadFunc                  : Starting Asynchronous operation on sound 0x155e9c048
[LOG] SystemI::createSoundInternal             :     filename = http://uploadserver.oss.aliyuncs.com/745/699745/1443431047-55.mp3 : mode 00010080
[LOG] SystemI::createSoundInternal             :     exinfo->cbsize             = 216
[LOG] SystemI::createSoundInternal             :     exinfo->suggestedsoundtype = 9
[LOG] SystemI::createSoundInternal             :     Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             :     Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              :     decode buffersize = 17280 : blocksize = 1152 : format = 2
[LOG] SystemI::createSample                    :     mode 00010082 length 17280 samples, lengthbytes 3617328
[LOG] SystemI::createSample                    :     channels = 2
[LOG] SystemI::createSample                    :     output = 0x155d335e8
[LOG] OutputSoftware::createSample             :     lengthpcm 17280, lengthbytes 3617328, channels 2, format 2, freq 44100, mode 0001008a
[LOG] System::createSoundInternal              :     Seek stream to start
[LOG] System::createSoundInternal              :     flush stream buffer
[LOG] System::createSoundInternal              :     flush successful.
[LOG] System::createSoundInternal              :     switch file handle from small blocking single buffered to large nonblocking doublebuffered.
[LOG] Thread::initThread                       :         Initializing FMOD file thread.  priority 1
[LOG] Thread::initThread                       :         - Stacksize 16384.  Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
[LOG] Thread::callback                         :         * FMOD file thread started
[LOG] SystemI::createSoundInternal             :     No name found in file, use filename.
[LOG] SystemI::createSoundInternal             :     done.  OpenState now = FMOD_OPENSTATE_READY.

[LOG] AsyncThread::threadFunc                  : Finished Asynchronous operation on sound 0x155e9c048
  • Mathew Block
    I’ve updated my answer, you have indeed found a bug.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.