<html><head></head><body>Hi,<br><br>As far as I understand the link, it is the application's responsibility, not the user's, to set that value optimally.<br><br><div class="gmail_quote">Le 21 juillet 2020 17:01:25 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">This option can be used to change the I/O buffer size.<br><br>cf. <a href="https://developer.apple.com/library/archive/technotes/tn2321/_index.html">https://developer.apple.com/library/archive/technotes/tn2321/_index.html</a><hr> modules/audio_output/audiounit_ios.m | 2 +-<br> modules/audio_output/auhal.c | 8 ++++++++<br> modules/audio_output/coreaudio_common.c | 16 +++++++++++++++-<br> modules/audio_output/coreaudio_common.h | 2 +-<br> 4 files changed, 25 insertions(+), 3 deletions(-)<br><br>diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m<br>index e0547b514f0..6de6af0aec7 100644<br>--- a/modules/audio_output/audiounit_ios.m<br>+++ b/modules/audio_output/audiounit_ios.m<br>@@ -536,7 +536,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)<br> vlc_tick_from_sec([p_sys->avInstance outputLatency]);<br> msg_Dbg(p_aout, "Current device has a latency of %lld us", latency_us);<br> <br>- ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, latency_us, NULL);<br>+ ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, latency_us, 0, NULL);<br> if (ret != VLC_SUCCESS)<br> goto error;<br> <br>diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c<br>index ab614c92a00..0bf3b2b809a 100644<br>--- a/modules/audio_output/auhal.c<br>+++ b/modules/audio_output/auhal.c<br>@@ -46,6 +46,10 @@<br> #define DEVICE_TEXT N_("Last audio device")<br> #define DEVICE_LONGTEXT DEVICE_TEXT<br> <br>+#define BUFFER_FRAME_SIZE_TEXT "Auhal I/O buffer size in frames"<br>+#define BUFFER_FRAME_SIZE_LONGTEXT "A low value (16-32) reduces audio latency," \<br>+ "a higher value (> 1024) improves power consumption"<br>+<br> static int Open (vlc_object_t *);<br> static void Close (vlc_object_t *);<br> <br>@@ -59,6 +63,8 @@ vlc_module_begin ()<br> add_integer("auhal-volume", AOUT_VOLUME_DEFAULT,<br> VOLUME_TEXT, VOLUME_LONGTEXT, true)<br> change_integer_range(0, AOUT_VOLUME_MAX)<br>+ add_integer("auhal-buffer-frame-size", 0 /* system default */,<br>+ BUFFER_FRAME_SIZE_TEXT, BUFFER_FRAME_SIZE_LONGTEXT, true)<br> add_string("auhal-audio-device", "", DEVICE_TEXT, DEVICE_LONGTEXT, true)<br> add_string("auhal-warned-devices", "", NULL, NULL, true)<br> change_private()<br>@@ -1112,7 +1118,9 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)<br> <br> /* Do the last VLC aout setups */<br> bool warn_configuration;<br>+<br> int ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, 0,<br>+ var_InheritInteger(p_aout, "auhal-buffer-frame-size"),<br> &warn_configuration);<br> if (ret != VLC_SUCCESS)<br> goto error;<br>diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c<br>index 797c3e623d3..8d8be946edf 100644<br>--- a/modules/audio_output/coreaudio_common.c<br>+++ b/modules/audio_output/coreaudio_common.c<br>@@ -840,7 +840,7 @@ SetupInputLayout(audio_output_t *p_aout, const audio_sample_format_t *fmt,<br> int<br> au_Initialize(audio_output_t *p_aout, AudioUnit au, audio_sample_format_t *fmt,<br> const AudioChannelLayout *outlayout, vlc_tick_t i_dev_latency_us,<br>- bool *warn_configuration)<br>+ unsigned buffer_frame_size, bool *warn_configuration)<br> {<br> int ret;<br> AudioChannelLayoutTag inlayout_tag;<br>@@ -938,6 +938,20 @@ au_Initialize(audio_output_t *p_aout, AudioUnit au, audio_sample_format_t *fmt,<br> return VLC_EGENERIC;<br> }<br> <br>+ if (buffer_frame_size > 0)<br>+ {<br>+ UInt32 buffer_size = buffer_frame_size;<br>+ err = AudioUnitSetProperty(au, kAudioDevicePropertyBufferFrameSize,<br>+ kAudioUnitScope_Output, 0, &buffer_size,<br>+ sizeof(buffer_size));<br>+ if (err != noErr)<br>+ {<br>+ ca_LogErr("failed to setup buffer frame size");<br>+ return VLC_EGENERIC;<br>+ }<br>+ }<br>+<br>+<br> /* AU init */<br> err = AudioUnitInitialize(au);<br> <br>diff --git a/modules/audio_output/coreaudio_common.h b/modules/audio_output/coreaudio_common.h<br>index 4bd61394937..272399689f8 100644<br>--- a/modules/audio_output/coreaudio_common.h<br>+++ b/modules/audio_output/coreaudio_common.h<br>@@ -111,6 +111,6 @@ AudioUnit au_NewOutputInstance(audio_output_t *p_aout, OSType comp_sub_type);<br> int au_Initialize(audio_output_t *p_aout, AudioUnit au,<br> audio_sample_format_t *fmt,<br> const AudioChannelLayout *outlayout, vlc_tick_t i_dev_latency_us,<br>- bool *warn_configuration);<br>+ unsigned buffer_frame_size, bool *warn_configuration);<br> <br> void au_Uninitialize(audio_output_t *p_aout, AudioUnit au);</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>