ReplayKit + FMOD

Hi All,


I'm having trouble getting FMOD Studio (the low level API) and ReplayKit to work together. When I call startRecordingWithMicrophoneEnabled, the prompt for approving recording is shown, once the user approves the recording the music and sound effects cut out and the recording immediately stops.


I have a thread with FMOD support and so far we haven't quite figured out what's wrong. It seems like the AudioQueue gets killed. Suspending and resuming the FMOD mixer before/after recording does not seem to help nor does changing the AVAudioSession Category.


Has any one else come across this? Were you able to work around it?


Here's the thread on FMOD:

http://www.fmod.org/questions/question/apple-replaykit-getting-a-contact-fmod-support-message/


Here's a slightly trimmed log:


Wed Sep 30 09:11:51 2015 - Level::load - suspending audio mixer.
[LOG] SystemI::mixerSuspend                    : Suspending output.
LOADING COMPRESSED SAMPLE
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/670ACF38-1565-4D2F-8A78-9C93A9FFCCD7/Apocalypse Meow.app/Audio/human_detected.fsb : mode 00000088
[LOG] SystemI::createSoundInternal             : Format has 1 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 91840
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x139990be8
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 91840, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : 1 subsounds detected.
[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] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.
... trimmed, a bunch more audio files are loaded ...
LOAD TIME IN SECONDS SECONDS: 0.281481
Wed Sep 30 09:11:56 2015 - Level::initialize - Starting replay record.
2015-09-30 09:11:56.835 Apocalypse Meow[2258:967808] STARTED RECORDING
[LOG] SoundI::release                          : menu.m4a (0x1399e66a8)
[LOG] SoundI::release                          : remove stream samples. (0x1399e66a8)
[LOG] SoundI::release                          :      (0x1399e6978)
[LOG] SoundI::release                          : release codec. (0x1399e66a8)
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/670ACF38-1565-4D2F-8A78-9C93A9FFCCD7/Apocalypse Meow.app/Audio/Level_2_song.m4a : mode 0000008a
[ERR] CodecFSB5::headerReadCheck               : Header check failed. Not an FSB5
[ERR] CodecVAG::openInternal                   : 'VAG' ID check failed [[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [v?? ]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [??? ]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [??? ]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [??? ]
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 1249859
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x139990be8
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 1249859, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[ERR] CodecAudioQueue::readInternal            : Cannot offline render audio queue. (err: -308)
[LOG] SoundI::release                          :  (0x139a92d88)
[LOG] SoundI::release                          : remove stream samples. (0x139a92d88)
[LOG] SoundI::release                          :      (0x139a93058)
[LOG] SoundI::release                          : release codec. (0x139a92d88)
[ERR] CodecAudioQueue::closeInternal           : Cannot dispose audio queue. (err: -66671)
FMOD error! (28) An error occurred that wasn't supposed to.  Contact support.
FMOD error! (31) An invalid parameter was passed to this function.
2015-09-30 09:11:57.882 Apocalypse Meow[2258:967913] The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)
2015-09-30 09:12:00.044 Apocalypse Meow[2258:967917] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
Wed Sep 30 09:12:01 2015 - Level::startGame - resuming audio mixer.
[LOG] SystemI::mixerResume                     : Resuming output.
[ERR] OutputCoreAudio::suspend                 : Cannot start audio unit. (err: -50)
LOADING COMPRESSED SAMPLE
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/670ACF38-1565-4D2F-8A78-9C93A9FFCCD7/Apocalypse Meow.app/Audio/Dialog/stay alert only a hero can survive.fsb : mode 00000088
[LOG] SystemI::createSoundInternal             : Format has 1 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 211136
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x139990be8
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 211136, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : 1 subsounds detected.
[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] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.


[LOG] SoundI::getSubSound                      : sound 0x139b44f88.  Subsound index 0 / 1
[LOG] SoundI::release                          : thruster_flyby (0x139b1ab68)
[LOG] SoundI::release                          : remove stream samples. (0x139b1ab68)
[LOG] SoundI::release                          :     thruster_flyby (0x139b1ae38)
[LOG] SoundI::release                          : release subsounds. (0x139b1ab68)
[LOG] SoundI::release                          :     thruster_flyby (0x139b1b1e8)
[LOG] SoundI::release                          : release codec. (0x139b1ab68)

Replies

Quick follow up, we still haven't determined why this isn't working. The FMOD engineer who has been kindly assisting me believes this is some sort of a ReplayKit bug, please see the link above for more details.


I'm surprised no one else has run into this, maybe we're missing something obvious. What's the best way to get Apple's eyes on this?

Hi, Cirrus!


I have the same problem. Did you solved it? Or any work around?