[vlc-commits] aout: coreaudio: handle AUDIO_CHANNELS_TYPE_AMBISONICS

Thomas Guillem git at videolan.org
Wed Jul 19 18:58:25 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 19 13:24:08 2017 +0200| [eb41ed33a9166c5bf383111e08bac13b480e18da] | committer: Thomas Guillem

aout: coreaudio: handle AUDIO_CHANNELS_TYPE_AMBISONICS

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb41ed33a9166c5bf383111e08bac13b480e18da
---

 modules/audio_output/audiounit_ios.m    |  1 +
 modules/audio_output/auhal.c            |  1 +
 modules/audio_output/coreaudio_common.c | 16 ++++++++++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m
index ab212f44d7..b189264ff2 100644
--- a/modules/audio_output/audiounit_ios.m
+++ b/modules/audio_output/audiounit_ios.m
@@ -438,6 +438,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
            name:AVAudioSessionRouteChangeNotification object:nil];
 
     free(layout);
+    fmt->channel_type = AUDIO_CHANNEL_TYPE_BITMAP;
     p_aout->mute_set  = MuteSet;
     p_aout->pause = Pause;
     msg_Dbg(p_aout, "analog AudioUnit output successfully opened for %4.4s %s",
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 3adfdce784..c1382a7911 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1488,6 +1488,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
         if (StartAnalog(p_aout, fmt, i_latency_us) == VLC_SUCCESS)
         {
             msg_Dbg(p_aout, "analog output successfully opened");
+            fmt->channel_type = AUDIO_CHANNEL_TYPE_BITMAP;
             return VLC_SUCCESS;
         }
     }
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index f37d93d240..f85b0552f0 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -202,8 +202,20 @@ ca_Initialize(audio_output_t *p_aout, const audio_sample_format_t *fmt,
     p_sys->i_dev_latency_us = i_dev_latency_us;
 
     /* setup circular buffer */
-    const size_t i_audiobuffer_size = AOUT_MAX_ADVANCE_TIME * fmt->i_rate *
-        fmt->i_bytes_per_frame / p_sys->i_frame_length / CLOCK_FREQ;
+    size_t i_audiobuffer_size = fmt->i_rate * fmt->i_bytes_per_frame
+                              / p_sys->i_frame_length;
+    if (fmt->channel_type == AUDIO_CHANNEL_TYPE_AMBISONICS)
+    {
+        /* low latency: 40 ms of buffering */
+        i_audiobuffer_size = i_audiobuffer_size / 25;
+    }
+    else
+    {
+        /* 2 seconds of buffering */
+        i_audiobuffer_size = i_audiobuffer_size * AOUT_MAX_ADVANCE_TIME
+                           / CLOCK_FREQ;
+    }
+    fprintf(stderr, "i_audiobuffer_size: %zu\n", i_audiobuffer_size);
     if (!TPCircularBufferInit(&p_sys->circular_buffer, i_audiobuffer_size))
         return VLC_EGENERIC;
 



More information about the vlc-commits mailing list