[io] sink_apple_audio uses software-based encoding on ios
authorPaul Brossier <piem@piem.org>
Wed, 19 Dec 2018 14:25:04 +0000 (15:25 +0100)
committerPaul Brossier <piem@piem.org>
Wed, 19 Dec 2018 14:25:04 +0000 (15:25 +0100)
src/io/sink_apple_audio.c

index f93691f..e007900 100644 (file)
@@ -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);