Commit e0a07ea8 authored by Simon Morlat's avatar Simon Morlat
Browse files

Audio flowcontrol algorithm improved: try to eliminate silent audio buffers...

Audio flowcontrol algorithm improved: try to eliminate silent audio buffers first, then use zero-crossing technique. This should cause sample drops to be more silent.
Also add properties to choose a drop policy (soft or basic), and set the silent threshold.
parent 62a96e96
......@@ -31,6 +31,7 @@
#include "mediastreamer2/msfileplayer.h"
#include "mediastreamer2/msvolume.h"
#include "mediastreamer2/flowcontrol.h"
#include "linphone/core.h"
......@@ -540,6 +541,25 @@ void MS2AudioStream::parameterizeEqualizer(AudioStream *as, LinphoneCore *lc) {
void MS2AudioStream::configureFlowControl(AudioStream *as, LinphoneCore *lc){
if (as->flowcontrol){
LinphoneConfig *config = linphone_core_get_config(lc);
MSAudioFlowControlConfig cfg;
memset(&cfg, 0, sizeof(cfg));
string strategy = linphone_config_get_string(config, "sound", "flow_control_strategy", "soft");
if (strategy == "soft")
cfg.strategy = MSAudioFlowControlSoft;
else if (strategy == "basic"){
cfg.strategy = MSAudioFlowControlBasic;
lError() << "Unsupported flow_control_strategy '" << strategy <<"'";
cfg.silent_threshold = linphone_config_get_float(config, "sound", "flow_control_silence_threshold", 0.02f);
ms_filter_call_method(as->flowcontrol, MS_AUDIO_FLOW_CONTROL_SET_CONFIG, &cfg);
void MS2AudioStream::postConfigureAudioStream(AudioStream *as, LinphoneCore *lc, bool muted){
audio_stream_enable_mic(as, !muted);
......@@ -588,6 +608,7 @@ void MS2AudioStream::postConfigureAudioStream(AudioStream *as, LinphoneCore *lc,
ms_filter_call_method(f, MS_VOLUME_SET_NOISE_GATE_FLOORGAIN, &floorGain);
parameterizeEqualizer(as, lc);
configureFlowControl(as, lc);
void MS2AudioStream::postConfigureAudioStream(bool muted) {
......@@ -184,6 +184,7 @@ private:
void setZrtpCryptoTypesParameters(MSZrtpParams *params, bool haveZrtpHash);
void startZrtpPrimaryChannel(const OfferAnswerContext &params);
static void parameterizeEqualizer(AudioStream *as, LinphoneCore *lc);
static void configureFlowControl(AudioStream *as, LinphoneCore *lc);
void forceSpeakerMuted(bool muted);
void postConfigureAudioStream(bool muted);
void setupRingbackPlayer();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment