From 99365e9922e6516dbd63b084de996573c5f5a767 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 19 Dec 2018 15:25:04 +0100 Subject: [PATCH] [io] sink_apple_audio uses software-based encoding on ios --- src/io/sink_apple_audio.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/io/sink_apple_audio.c b/src/io/sink_apple_audio.c index f93691f5..e0079008 100644 --- a/src/io/sink_apple_audio.c +++ b/src/io/sink_apple_audio.c @@ -238,6 +238,20 @@ uint_t aubio_sink_apple_audio_open(aubio_sink_apple_audio_t *s) { goto beach; } +#if defined(kAppleSoftwareAudioCodecManufacturer) + // on iOS, set software based encoding before setting clientDataFormat + UInt32 codecManf = kAppleSoftwareAudioCodecManufacturer; + err = ExtAudioFileSetProperty(s->audioFile, + kExtAudioFileProperty_CodecManufacturer, + sizeof(UInt32), &codecManf); + if (err) { + char_t errorstr[20]; + AUBIO_ERR("sink_apple_audio: error when trying to set sofware codec on %s " + "(%s)\n", s->path, getPrintableOSStatusError(errorstr, err)); + goto beach; + } +#endif + err = ExtAudioFileSetProperty(s->audioFile, kExtAudioFileProperty_ClientDataFormat, sizeof(AudioStreamBasicDescription), &inputFormat); -- 2.11.0