Bug 1307724 - Cherry-pick cubeb revision 50d92c. r=kinetik

MozReview-Commit-ID: 2ibCLal3BVD

--HG--
extra : rebase_source : 42dbab3510abdb390c6287df95721a17be7a1e4d
This commit is contained in:
Paul Adenot 2016-10-05 12:20:06 +02:00
Родитель 0204ed8e4c
Коммит d31503d9d3
3 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -687,7 +687,7 @@ refill_callback_duplex(cubeb_stream * stm)
// When WASAPI has not filled the input buffer yet, send silence.
double output_duration = double(output_frames) / stm->output_mix_params.rate;
double input_duration = double(stm->linear_input_buffer.length() / stm->input_mix_params.channels) / stm->input_mix_params.rate;
double input_duration = double(stm->linear_input_buffer.length() / stm->input_stream_params.channels) / stm->input_mix_params.rate;
if (input_duration < output_duration) {
size_t padding = size_t(round((output_duration - input_duration) * stm->input_mix_params.rate));
LOG("padding silence: out=%f in=%f pad=%u\n", output_duration, input_duration, padding);

Просмотреть файл

@ -59,3 +59,5 @@ fi
echo "Applying a patch on top of $version"
patch -p1 < ./wasapi-drift.patch
echo "Applying another patch on top of $version"
patch -p1 < ./wasapi-stereo-mic.patch

Просмотреть файл

@ -0,0 +1,28 @@
From 50d92c0eaa05a93f4dd8ff5072e983c6c84d0369 Mon Sep 17 00:00:00 2001
From: Paul Adenot <paul@paul.cx>
Date: Tue, 4 Oct 2016 07:18:04 -0700
Subject: [PATCH] Divide by the number of channel of the stream to compute the
duratio of the buffer.
We downmix right before, so this is in frames in with the channel count of the
stream, not the mix.
---
src/cubeb_wasapi.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
index bd2cbed..87aa305 100644
--- a/src/cubeb_wasapi.cpp
+++ b/src/cubeb_wasapi.cpp
@@ -687,7 +687,7 @@ refill_callback_duplex(cubeb_stream * stm)
// When WASAPI has not filled the input buffer yet, send silence.
double output_duration = double(output_frames) / stm->output_mix_params.rate;
- double input_duration = double(stm->linear_input_buffer.length() / stm->input_mix_params.channels) / stm->input_mix_params.rate;
+ double input_duration = double(stm->linear_input_buffer.length() / stm->input_stream_params.channels) / stm->input_mix_params.rate;
if (input_duration < output_duration) {
size_t padding = size_t(round((output_duration - input_duration) * stm->input_mix_params.rate));
LOG("padding silence: out=%f in=%f pad=%u\n", output_duration, input_duration, padding);
--
2.7.4