[vlc-commits] wasapi: set max buffer duration to 2 seconds in exclusive mode

Thomas Guillem git at videolan.org
Tue Jan 24 09:37:06 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 17 13:18:35 2017 +0100| [55b4efce04665ca0266ecf4403ce0414876cd80f] | committer: Thomas Guillem

wasapi: set max buffer duration to 2 seconds in exclusive mode

See AUDCLNT_E_BUFFER_SIZE_ERROR in IAudioClient::Initialize msdn doc.

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

 modules/audio_output/wasapi.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index cafca6b..424a496 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -472,18 +472,15 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
     {
         vlc_SpdifToWave(pwfe, &fmt);
         shared_mode = AUDCLNT_SHAREMODE_EXCLUSIVE;
-        buffer_duration = AOUT_MAX_PREPARE_TIME * 10;
+        /* The max buffer duration in exclusive mode is 2 seconds */
+        buffer_duration = AOUT_MAX_PREPARE_TIME;
     }
     else if (AOUT_FMT_HDMI(&fmt))
     {
         vlc_HdmiToWave(&wf_iec61937, &fmt);
         shared_mode = AUDCLNT_SHAREMODE_EXCLUSIVE;
-
-        /* Less buffer duration for these very high sample rate codecs
-         * (IAudioClient_Initialize return an out of memory error if higher).
-         * It seems that the max buffer size for EXCLUSIVE/HDMI is 1MB (there
-         * is no such limitation for PCM). */
-        buffer_duration = CLOCK_FREQ * 10 * 1024 * 1024 / pwf->nAvgBytesPerSec;
+        /* The max buffer duration in exclusive mode is 2 seconds */
+        buffer_duration = AOUT_MAX_PREPARE_TIME;
     }
     else if (AOUT_FMT_LINEAR(&fmt))
     {



More information about the vlc-commits mailing list