Skip to content
Snippets Groups Projects
Commit a032cb1d authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin
Browse files

fix: audio jittering

Use the bigger sample_rate to avoid loosing data in the audio
processing.

GitLab: #741

Change-Id: I8f96923ee9f67767d4f2d4c73785a88925c5f031
parent c41e22f7
No related branches found
No related tags found
No related merge requests found
......@@ -155,13 +155,10 @@ AudioLayer::setHasNativeAEC(bool hasNativeAEC)
void
AudioLayer::createAudioProcessor()
{
auto nb_channels = std::min(audioFormat_.nb_channels, audioInputFormat_.nb_channels);
auto sample_rate = std::min(audioFormat_.sample_rate, audioInputFormat_.sample_rate);
auto nb_channels = std::max(audioFormat_.nb_channels, audioInputFormat_.nb_channels);
auto sample_rate = std::max(audioFormat_.sample_rate, audioInputFormat_.sample_rate);
// TODO: explain/rework this math??
if (sample_rate % 16000u != 0)
sample_rate = 16000u * ((sample_rate / 16000u) + 1u);
sample_rate = std::clamp(sample_rate, 16000u, 96000u);
sample_rate = std::clamp(sample_rate, 16000u, 48000u);
AudioFormat formatForProcessor {sample_rate, nb_channels};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment