- Begin adding support for Google WebRTC

- This revision adds support for WebRTC's AEC and Noise Suppression
This commit is contained in:
bossiel 2011-08-01 05:14:45 +00:00
parent 063e7ca105
commit 049f6025ff
89 changed files with 1857 additions and 16 deletions

View File

@ -156,6 +156,11 @@ uint32_t MediaSessionMgr::defaultsGetEchoTail()
return tmedia_defaults_get_echo_tail(); return tmedia_defaults_get_echo_tail();
} }
bool MediaSessionMgr::defaultsSetEchoSkew(uint32_t echo_skew)
{
return tmedia_defaults_set_echo_skew(echo_skew) == 0;
}
bool MediaSessionMgr::defaultsSetEchoSuppEnabled(bool echo_supp_enabled) bool MediaSessionMgr::defaultsSetEchoSuppEnabled(bool echo_supp_enabled)
{ {
return tmedia_defaults_set_echo_supp_enabled(echo_supp_enabled) == 0; return tmedia_defaults_set_echo_supp_enabled(echo_supp_enabled) == 0;

View File

@ -60,6 +60,7 @@ public:
static tmedia_bandwidth_level_t defaultsGetBandwidthLevel(); static tmedia_bandwidth_level_t defaultsGetBandwidthLevel();
static bool defaultsSetEchoTail(uint32_t echo_tail); static bool defaultsSetEchoTail(uint32_t echo_tail);
static uint32_t defaultsGetEchoTail(); static uint32_t defaultsGetEchoTail();
static bool defaultsSetEchoSkew(uint32_t echo_skew);
static bool defaultsSetEchoSuppEnabled(bool echo_supp_enabled); static bool defaultsSetEchoSuppEnabled(bool echo_supp_enabled);
static bool defaultsGetEchoSuppEnabled(); static bool defaultsGetEchoSuppEnabled();
static bool defaultsSetAgcEnabled(bool agc_enabled); static bool defaultsSetAgcEnabled(bool agc_enabled);

View File

@ -96,6 +96,11 @@ public class MediaSessionMgr : IDisposable {
return ret; return ret;
} }
public static bool defaultsSetEchoSkew(uint echo_skew) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetEchoSkew(echo_skew);
return ret;
}
public static bool defaultsSetEchoSuppEnabled(bool echo_supp_enabled) { public static bool defaultsSetEchoSuppEnabled(bool echo_supp_enabled) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetEchoSuppEnabled(echo_supp_enabled); bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetEchoSuppEnabled(echo_supp_enabled);
return ret; return ret;

View File

@ -290,6 +290,9 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsGetEchoTail")] [DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsGetEchoTail")]
public static extern uint MediaSessionMgr_defaultsGetEchoTail(); public static extern uint MediaSessionMgr_defaultsGetEchoTail();
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetEchoSkew")]
public static extern bool MediaSessionMgr_defaultsSetEchoSkew(uint jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetEchoSuppEnabled")] [DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetEchoSuppEnabled")]
public static extern bool MediaSessionMgr_defaultsSetEchoSuppEnabled(bool jarg1); public static extern bool MediaSessionMgr_defaultsSetEchoSuppEnabled(bool jarg1);

View File

@ -1566,6 +1566,18 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsGetEchoTail()
} }
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetEchoSkew(unsigned int jarg1) {
unsigned int jresult ;
uint32_t arg1 ;
bool result;
arg1 = (uint32_t)jarg1;
result = (bool)MediaSessionMgr::defaultsSetEchoSkew(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetEchoSuppEnabled(unsigned int jarg1) { SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetEchoSuppEnabled(unsigned int jarg1) {
unsigned int jresult ; unsigned int jresult ;
bool arg1 ; bool arg1 ;

View File

@ -79,6 +79,10 @@ public class MediaSessionMgr {
return tinyWRAPJNI.MediaSessionMgr_defaultsGetEchoTail(); return tinyWRAPJNI.MediaSessionMgr_defaultsGetEchoTail();
} }
public static boolean defaultsSetEchoSkew(long echo_skew) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetEchoSkew(echo_skew);
}
public static boolean defaultsSetEchoSuppEnabled(boolean echo_supp_enabled) { public static boolean defaultsSetEchoSuppEnabled(boolean echo_supp_enabled) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetEchoSuppEnabled(echo_supp_enabled); return tinyWRAPJNI.MediaSessionMgr_defaultsSetEchoSuppEnabled(echo_supp_enabled);
} }

View File

@ -79,6 +79,10 @@ public class MediaSessionMgr {
return tinyWRAPJNI.MediaSessionMgr_defaultsGetEchoTail(); return tinyWRAPJNI.MediaSessionMgr_defaultsGetEchoTail();
} }
public static boolean defaultsSetEchoSkew(long echo_skew) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetEchoSkew(echo_skew);
}
public static boolean defaultsSetEchoSuppEnabled(boolean echo_supp_enabled) { public static boolean defaultsSetEchoSuppEnabled(boolean echo_supp_enabled) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetEchoSuppEnabled(echo_supp_enabled); return tinyWRAPJNI.MediaSessionMgr_defaultsSetEchoSuppEnabled(echo_supp_enabled);
} }

View File

@ -6,6 +6,6 @@ export COMMERCIAL_PARAMS="LICENSE=lgpl FFMPEG=yes H264=no THEORA=yes OPENCORE_AM
for IS_NEON in no yes for IS_NEON in no yes
do do
../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $COMMERCIAL_PARAMS ../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $COMMERCIAL_PARAMS HAVE_WEBRTC=$IS_NEON HAVE_WEBRTC_DENOISE=$IS_NEON
done done

View File

@ -42,6 +42,10 @@ ifeq ($(SPEEX), yes)
SPEEX_LDFLAGS := -lspeex SPEEX_LDFLAGS := -lspeex
endif endif
ifeq ($(HAVE_WEBRTC), yes)
WEBRTC_LDFLAGS := -lwebrtc_aec_$(MARCH) -lwebrtc_apm_utility_$(MARCH) -lwebrtc_ns_$(MARCH) -lwebrtc_system_wrappers_$(MARCH)
endif
ifeq ($(ILBC), yes) ifeq ($(ILBC), yes)
ILBC_LDFLAGS := -liLBC ILBC_LDFLAGS := -liLBC
endif endif
@ -68,7 +72,7 @@ else
_LT=Bstatic _LT=Bstatic
endif endif
LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) $(FFMPEG_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(SPEEX_LDFLAGS) $(OPENCORE_ARM_LDFLAGS) $(BV16_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(G729_LDFLAGS)\ LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) $(FFMPEG_LDFLAGS) $(WEBRTC_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(SPEEX_LDFLAGS) $(OPENCORE_ARM_LDFLAGS) $(BV16_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(G729_LDFLAGS)\
-Wl,-Bdynamic -lm -lstdc++ -lgcc -llog \ -Wl,-Bdynamic -lm -lstdc++ -lgcc -llog \
-Wl,-$(_LT) -ltinySAK_$(MARCH) -ltinyHTTP_$(MARCH) -ltinyXCAP_$(MARCH) -ltinyIPSec_$(MARCH) -ltinySIGCOMP_$(MARCH) -ltinySMS_$(MARCH) -ltinyNET_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -ltinyDAV_$(MARCH) -ltinySIP_$(MARCH) -Wl,-$(_LT) -ltinySAK_$(MARCH) -ltinyHTTP_$(MARCH) -ltinyXCAP_$(MARCH) -ltinyIPSec_$(MARCH) -ltinySIGCOMP_$(MARCH) -ltinySMS_$(MARCH) -ltinyNET_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -ltinyDAV_$(MARCH) -ltinySIP_$(MARCH)

View File

@ -6,6 +6,6 @@ export GPL_PARAMS="LICENSE=gpl NO_FREE=yes FFMPEG=yes H264=yes THEORA=yes OPENCO
for IS_NEON in no yes for IS_NEON in no yes
do do
../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $GPL_PARAMS ../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $GPL_PARAMS HAVE_WEBRTC=$IS_NEON HAVE_WEBRTC_DENOISE=$IS_NEON
done done

View File

@ -6,6 +6,6 @@ export LGPL_PARAMS="LICENSE=lgpl FFMPEG=yes H264=no THEORA=yes OPENCORE_AMR=yes
for IS_NEON in no yes for IS_NEON in no yes
do do
../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $LGPL_PARAMS ../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $LGPL_PARAMS HAVE_WEBRTC=$IS_NEON HAVE_WEBRTC_DENOISE=$IS_NEON
done done

View File

@ -6,5 +6,5 @@ export MINIMAL_PARAMS="FFMPEG=no H264=no THEORA=no OPENCORE_AMR=no SPEEX_DSP=yes
for IS_NEON in no yes for IS_NEON in no yes
do do
../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $MINIMAL_PARAMS ../bindings/java/android/buildAll.sh $@ NEON=$IS_NEON $MINIMAL_PARAMS HAVE_WEBRTC=$IS_NEON HAVE_WEBRTC_DENOISE=$IS_NEON
done done

View File

@ -45,6 +45,7 @@ class tinyWRAPJNI {
public final static native int MediaSessionMgr_defaultsGetBandwidthLevel(); public final static native int MediaSessionMgr_defaultsGetBandwidthLevel();
public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1); public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1);
public final static native long MediaSessionMgr_defaultsGetEchoTail(); public final static native long MediaSessionMgr_defaultsGetEchoTail();
public final static native boolean MediaSessionMgr_defaultsSetEchoSkew(long jarg1);
public final static native boolean MediaSessionMgr_defaultsSetEchoSuppEnabled(boolean jarg1); public final static native boolean MediaSessionMgr_defaultsSetEchoSuppEnabled(boolean jarg1);
public final static native boolean MediaSessionMgr_defaultsGetEchoSuppEnabled(); public final static native boolean MediaSessionMgr_defaultsGetEchoSuppEnabled();
public final static native boolean MediaSessionMgr_defaultsSetAgcEnabled(boolean jarg1); public final static native boolean MediaSessionMgr_defaultsSetAgcEnabled(boolean jarg1);

View File

@ -2464,6 +2464,20 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_
} }
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetEchoSkew(JNIEnv *jenv, jclass jcls, jlong jarg1) {
jboolean jresult = 0 ;
uint32_t arg1 ;
bool result;
(void)jenv;
(void)jcls;
arg1 = (uint32_t)jarg1;
result = (bool)MediaSessionMgr::defaultsSetEchoSkew(arg1);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetEchoSuppEnabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) { SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetEchoSuppEnabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
jboolean jresult = 0 ; jboolean jresult = 0 ;
bool arg1 ; bool arg1 ;

View File

@ -45,6 +45,7 @@ class tinyWRAPJNI {
public final static native int MediaSessionMgr_defaultsGetBandwidthLevel(); public final static native int MediaSessionMgr_defaultsGetBandwidthLevel();
public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1); public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1);
public final static native long MediaSessionMgr_defaultsGetEchoTail(); public final static native long MediaSessionMgr_defaultsGetEchoTail();
public final static native boolean MediaSessionMgr_defaultsSetEchoSkew(long jarg1);
public final static native boolean MediaSessionMgr_defaultsSetEchoSuppEnabled(boolean jarg1); public final static native boolean MediaSessionMgr_defaultsSetEchoSuppEnabled(boolean jarg1);
public final static native boolean MediaSessionMgr_defaultsGetEchoSuppEnabled(); public final static native boolean MediaSessionMgr_defaultsGetEchoSuppEnabled();
public final static native boolean MediaSessionMgr_defaultsSetAgcEnabled(boolean jarg1); public final static native boolean MediaSessionMgr_defaultsSetAgcEnabled(boolean jarg1);

View File

@ -2464,6 +2464,20 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_
} }
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetEchoSkew(JNIEnv *jenv, jclass jcls, jlong jarg1) {
jboolean jresult = 0 ;
uint32_t arg1 ;
bool result;
(void)jenv;
(void)jcls;
arg1 = (uint32_t)jarg1;
result = (bool)MediaSessionMgr::defaultsSetEchoSkew(arg1);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetEchoSuppEnabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) { SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetEchoSuppEnabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
jboolean jresult = 0 ; jboolean jresult = 0 ;
bool arg1 ; bool arg1 ;

View File

@ -202,6 +202,7 @@ sub DESTROY {
*defaultsGetBandwidthLevel = *tinyWRAPc::MediaSessionMgr_defaultsGetBandwidthLevel; *defaultsGetBandwidthLevel = *tinyWRAPc::MediaSessionMgr_defaultsGetBandwidthLevel;
*defaultsSetEchoTail = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail; *defaultsSetEchoTail = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail;
*defaultsGetEchoTail = *tinyWRAPc::MediaSessionMgr_defaultsGetEchoTail; *defaultsGetEchoTail = *tinyWRAPc::MediaSessionMgr_defaultsGetEchoTail;
*defaultsSetEchoSkew = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoSkew;
*defaultsSetEchoSuppEnabled = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoSuppEnabled; *defaultsSetEchoSuppEnabled = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoSuppEnabled;
*defaultsGetEchoSuppEnabled = *tinyWRAPc::MediaSessionMgr_defaultsGetEchoSuppEnabled; *defaultsGetEchoSuppEnabled = *tinyWRAPc::MediaSessionMgr_defaultsGetEchoSuppEnabled;
*defaultsSetAgcEnabled = *tinyWRAPc::MediaSessionMgr_defaultsSetAgcEnabled; *defaultsSetAgcEnabled = *tinyWRAPc::MediaSessionMgr_defaultsSetAgcEnabled;

View File

@ -3455,6 +3455,34 @@ XS(_wrap_MediaSessionMgr_defaultsGetEchoTail) {
} }
XS(_wrap_MediaSessionMgr_defaultsSetEchoSkew) {
{
uint32_t arg1 ;
unsigned int val1 ;
int ecode1 = 0 ;
int argvi = 0;
bool result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: MediaSessionMgr_defaultsSetEchoSkew(echo_skew);");
}
ecode1 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetEchoSkew" "', argument " "1"" of type '" "uint32_t""'");
}
arg1 = static_cast< uint32_t >(val1);
result = (bool)MediaSessionMgr::defaultsSetEchoSkew(arg1);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled) { XS(_wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled) {
{ {
bool arg1 ; bool arg1 ;
@ -21269,6 +21297,7 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::MediaSessionMgr_defaultsGetBandwidthLevel", _wrap_MediaSessionMgr_defaultsGetBandwidthLevel}, {"tinyWRAPc::MediaSessionMgr_defaultsGetBandwidthLevel", _wrap_MediaSessionMgr_defaultsGetBandwidthLevel},
{"tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail}, {"tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail},
{"tinyWRAPc::MediaSessionMgr_defaultsGetEchoTail", _wrap_MediaSessionMgr_defaultsGetEchoTail}, {"tinyWRAPc::MediaSessionMgr_defaultsGetEchoTail", _wrap_MediaSessionMgr_defaultsGetEchoTail},
{"tinyWRAPc::MediaSessionMgr_defaultsSetEchoSkew", _wrap_MediaSessionMgr_defaultsSetEchoSkew},
{"tinyWRAPc::MediaSessionMgr_defaultsSetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled}, {"tinyWRAPc::MediaSessionMgr_defaultsSetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled},
{"tinyWRAPc::MediaSessionMgr_defaultsGetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsGetEchoSuppEnabled}, {"tinyWRAPc::MediaSessionMgr_defaultsGetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsGetEchoSuppEnabled},
{"tinyWRAPc::MediaSessionMgr_defaultsSetAgcEnabled", _wrap_MediaSessionMgr_defaultsSetAgcEnabled}, {"tinyWRAPc::MediaSessionMgr_defaultsSetAgcEnabled", _wrap_MediaSessionMgr_defaultsSetAgcEnabled},

View File

@ -161,6 +161,8 @@ class MediaSessionMgr(_object):
if _newclass:defaultsSetEchoTail = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetEchoTail) if _newclass:defaultsSetEchoTail = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetEchoTail)
__swig_getmethods__["defaultsGetEchoTail"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsGetEchoTail __swig_getmethods__["defaultsGetEchoTail"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsGetEchoTail
if _newclass:defaultsGetEchoTail = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsGetEchoTail) if _newclass:defaultsGetEchoTail = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsGetEchoTail)
__swig_getmethods__["defaultsSetEchoSkew"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetEchoSkew
if _newclass:defaultsSetEchoSkew = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetEchoSkew)
__swig_getmethods__["defaultsSetEchoSuppEnabled"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled __swig_getmethods__["defaultsSetEchoSuppEnabled"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled
if _newclass:defaultsSetEchoSuppEnabled = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled) if _newclass:defaultsSetEchoSuppEnabled = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled)
__swig_getmethods__["defaultsGetEchoSuppEnabled"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsGetEchoSuppEnabled __swig_getmethods__["defaultsGetEchoSuppEnabled"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsGetEchoSuppEnabled
@ -210,6 +212,10 @@ def MediaSessionMgr_defaultsGetEchoTail():
return _tinyWRAP.MediaSessionMgr_defaultsGetEchoTail() return _tinyWRAP.MediaSessionMgr_defaultsGetEchoTail()
MediaSessionMgr_defaultsGetEchoTail = _tinyWRAP.MediaSessionMgr_defaultsGetEchoTail MediaSessionMgr_defaultsGetEchoTail = _tinyWRAP.MediaSessionMgr_defaultsGetEchoTail
def MediaSessionMgr_defaultsSetEchoSkew(*args):
return _tinyWRAP.MediaSessionMgr_defaultsSetEchoSkew(*args)
MediaSessionMgr_defaultsSetEchoSkew = _tinyWRAP.MediaSessionMgr_defaultsSetEchoSkew
def MediaSessionMgr_defaultsSetEchoSuppEnabled(*args): def MediaSessionMgr_defaultsSetEchoSuppEnabled(*args):
return _tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled(*args) return _tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled(*args)
MediaSessionMgr_defaultsSetEchoSuppEnabled = _tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled MediaSessionMgr_defaultsSetEchoSuppEnabled = _tinyWRAP.MediaSessionMgr_defaultsSetEchoSuppEnabled

View File

@ -6159,6 +6159,28 @@ fail:
} }
SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetEchoSkew(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
uint32_t arg1 ;
unsigned int val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"O:MediaSessionMgr_defaultsSetEchoSkew",&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetEchoSkew" "', argument " "1"" of type '" "uint32_t""'");
}
arg1 = static_cast< uint32_t >(val1);
result = (bool)MediaSessionMgr::defaultsSetEchoSkew(arg1);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
bool arg1 ; bool arg1 ;
@ -20763,6 +20785,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"MediaSessionMgr_defaultsGetBandwidthLevel", _wrap_MediaSessionMgr_defaultsGetBandwidthLevel, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsGetBandwidthLevel", _wrap_MediaSessionMgr_defaultsGetBandwidthLevel, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsGetEchoTail", _wrap_MediaSessionMgr_defaultsGetEchoTail, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsGetEchoTail", _wrap_MediaSessionMgr_defaultsGetEchoTail, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetEchoSkew", _wrap_MediaSessionMgr_defaultsSetEchoSkew, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsSetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsSetEchoSuppEnabled, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsGetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsGetEchoSuppEnabled, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsGetEchoSuppEnabled", _wrap_MediaSessionMgr_defaultsGetEchoSuppEnabled, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetAgcEnabled", _wrap_MediaSessionMgr_defaultsSetAgcEnabled, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsSetAgcEnabled", _wrap_MediaSessionMgr_defaultsSetAgcEnabled, METH_VARARGS, NULL},

View File

@ -0,0 +1,260 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_INTERFACE_ECHO_CANCELLATION_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_INTERFACE_ECHO_CANCELLATION_H_
#include "typedefs.h"
// Errors
#define AEC_UNSPECIFIED_ERROR 12000
#define AEC_UNSUPPORTED_FUNCTION_ERROR 12001
#define AEC_UNINITIALIZED_ERROR 12002
#define AEC_NULL_POINTER_ERROR 12003
#define AEC_BAD_PARAMETER_ERROR 12004
// Warnings
#define AEC_BAD_PARAMETER_WARNING 12050
enum {
kAecNlpConservative = 0,
kAecNlpModerate,
kAecNlpAggressive
};
enum {
kAecFalse = 0,
kAecTrue
};
typedef struct {
WebRtc_Word16 nlpMode; // default kAecNlpModerate
WebRtc_Word16 skewMode; // default kAecFalse
WebRtc_Word16 metricsMode; // default kAecFalse
//float realSkew;
} AecConfig;
typedef struct {
WebRtc_Word16 instant;
WebRtc_Word16 average;
WebRtc_Word16 max;
WebRtc_Word16 min;
} AecLevel;
typedef struct {
AecLevel rerl;
AecLevel erl;
AecLevel erle;
AecLevel aNlp;
} AecMetrics;
#ifdef __cplusplus
extern "C" {
#endif
/*
* Allocates the memory needed by the AEC. The memory needs to be initialized
* separately using the WebRtcAec_Init() function.
*
* Inputs Description
* -------------------------------------------------------------------
* void **aecInst Pointer to the AEC instance to be created
* and initilized
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Create(void **aecInst);
/*
* This function releases the memory allocated by WebRtcAec_Create().
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Free(void *aecInst);
/*
* Initializes an AEC instance.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* WebRtc_Word32 sampFreq Sampling frequency of data
* WebRtc_Word32 scSampFreq Soundcard sampling frequency
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Init(void *aecInst,
WebRtc_Word32 sampFreq,
WebRtc_Word32 scSampFreq);
/*
* Inserts an 80 or 160 sample block of data into the farend buffer.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* WebRtc_Word16 *farend In buffer containing one frame of
* farend signal for L band
* WebRtc_Word16 nrOfSamples Number of samples in farend buffer
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_BufferFarend(void *aecInst,
const WebRtc_Word16 *farend,
WebRtc_Word16 nrOfSamples);
/*
* Runs the echo canceller on an 80 or 160 sample blocks of data.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* WebRtc_Word16 *nearend In buffer containing one frame of
* nearend+echo signal for L band
* WebRtc_Word16 *nearendH In buffer containing one frame of
* nearend+echo signal for H band
* WebRtc_Word16 nrOfSamples Number of samples in nearend buffer
* WebRtc_Word16 msInSndCardBuf Delay estimate for sound card and
* system buffers
* WebRtc_Word16 skew Difference between number of samples played
* and recorded at the soundcard (for clock skew
* compensation)
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word16 *out Out buffer, one frame of processed nearend
* for L band
* WebRtc_Word16 *outH Out buffer, one frame of processed nearend
* for H band
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Process(void *aecInst,
const WebRtc_Word16 *nearend,
const WebRtc_Word16 *nearendH,
WebRtc_Word16 *out,
WebRtc_Word16 *outH,
WebRtc_Word16 nrOfSamples,
WebRtc_Word16 msInSndCardBuf,
WebRtc_Word32 skew);
/*
* This function enables the user to set certain parameters on-the-fly.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* AecConfig config Config instance that contains all
* properties to be set
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_set_config(void *aecInst, AecConfig config);
/*
* Gets the on-the-fly paramters.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* AecConfig *config Pointer to the config instance that
* all properties will be written to
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_config(void *aecInst, AecConfig *config);
/*
* Gets the current echo status of the nearend signal.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word16 *status 0: Almost certainly nearend single-talk
* 1: Might not be neared single-talk
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_echo_status(void *aecInst, WebRtc_Word16 *status);
/*
* Gets the current echo metrics for the session.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* AecMetrics *metrics Struct which will be filled out with the
* current echo metrics.
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_GetMetrics(void *aecInst, AecMetrics *metrics);
/*
* Gets the last error code.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 11000-11100: error code
*/
WebRtc_Word32 WebRtcAec_get_error_code(void *aecInst);
/*
* Gets a version string.
*
* Inputs Description
* -------------------------------------------------------------------
* char *versionStr Pointer to a string array
* WebRtc_Word16 len The maximum length of the string
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word8 *versionStr Pointer to a string array
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_version(WebRtc_Word8 *versionStr, WebRtc_Word16 len);
#ifdef __cplusplus
}
#endif
#endif /* WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_INTERFACE_ECHO_CANCELLATION_H_ */

View File

@ -0,0 +1,124 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_
#include "typedefs.h"
typedef struct NsHandleT NsHandle;
#ifdef __cplusplus
extern "C" {
#endif
/*
* This function returns the version number of the code.
*
* Input:
* - version : Pointer to a character array where the version
* info is stored.
* - length : Length of version.
*
* Return value : 0 - Ok
* -1 - Error (probably length is not sufficient)
*/
int WebRtcNs_get_version(char *version, short length);
/*
* This function creates an instance to the noise reduction structure
*
* Input:
* - NS_inst : Pointer to noise reduction instance that should be
* created
*
* Output:
* - NS_inst : Pointer to created noise reduction instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_Create(NsHandle **NS_inst);
/*
* This function frees the dynamic memory of a specified Noise Reduction
* instance.
*
* Input:
* - NS_inst : Pointer to NS instance that should be freed
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_Free(NsHandle *NS_inst);
/*
* This function initializes a NS instance
*
* Input:
* - NS_inst : Instance that should be initialized
* - fs : sampling frequency
*
* Output:
* - NS_inst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_Init(NsHandle *NS_inst, WebRtc_UWord32 fs);
/*
* This changes the aggressiveness of the noise suppression method.
*
* Input:
* - NS_inst : Instance that should be initialized
* - mode : 0: Mild, 1: Medium , 2: Aggressive
*
* Output:
* - NS_inst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_set_policy(NsHandle *NS_inst, int mode);
/*
* This functions does Noise Suppression for the inserted speech frame. The
* input and output signals should always be 10ms (80 or 160 samples).
*
* Input
* - NS_inst : VAD Instance. Needs to be initiated before call.
* - spframe : Pointer to speech frame buffer for L band
* - spframe_H : Pointer to speech frame buffer for H band
* - fs : sampling frequency
*
* Output:
* - NS_inst : Updated NS instance
* - outframe : Pointer to output frame for L band
* - outframe_H : Pointer to output frame for H band
*
* Return value : 0 - OK
* -1 - Error
*/
int WebRtcNs_Process(NsHandle *NS_inst,
short *spframe,
short *spframe_H,
short *outframe,
short *outframe_H);
#ifdef __cplusplus
}
#endif
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_

View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_
#include "signal_processing_library.h"
typedef struct NsxHandleT NsxHandle;
#ifdef __cplusplus
extern "C" {
#endif
/*
* This function returns the version number of the code.
*
* Input:
* - version : Pointer to a character array where the version
* info is stored.
* - length : Length of version.
*
* Return value : 0 - Ok
* -1 - Error (probably length is not sufficient)
*/
int WebRtcNsx_get_version(char *version, short length);
/*
* This function creates an instance to the noise reduction structure
*
* Input:
* - nsxInst : Pointer to noise reduction instance that should be
* created
*
* Output:
* - nsxInst : Pointer to created noise reduction instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_Create(NsxHandle **nsxInst);
/*
* This function frees the dynamic memory of a specified Noise Suppression
* instance.
*
* Input:
* - nsxInst : Pointer to NS instance that should be freed
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_Free(NsxHandle *nsxInst);
/*
* This function initializes a NS instance
*
* Input:
* - nsxInst : Instance that should be initialized
* - fs : sampling frequency
*
* Output:
* - nsxInst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_Init(NsxHandle *nsxInst, WebRtc_UWord32 fs);
/*
* This changes the aggressiveness of the noise suppression method.
*
* Input:
* - nsxInst : Instance that should be initialized
* - mode : 0: Mild, 1: Medium , 2: Aggressive
*
* Output:
* - nsxInst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_set_policy(NsxHandle *nsxInst, int mode);
/*
* This functions does noise suppression for the inserted speech frame. The
* input and output signals should always be 10ms (80 or 160 samples).
*
* Input
* - nsxInst : NSx instance. Needs to be initiated before call.
* - speechFrame : Pointer to speech frame buffer for L band
* - speechFrameHB : Pointer to speech frame buffer for H band
* - fs : sampling frequency
*
* Output:
* - nsxInst : Updated NSx instance
* - outFrame : Pointer to output frame for L band
* - outFrameHB : Pointer to output frame for H band
*
* Return value : 0 - OK
* -1 - Error
*/
int WebRtcNsx_Process(NsxHandle *nsxInst,
short *speechFrame,
short *speechFrameHB,
short *outFrame,
short *outFrameHB);
#ifdef __cplusplus
}
#endif
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
*
* This file contains type definitions used in all WebRtc APIs.
*
*/
/* Reserved words definitions */
#define WEBRTC_EXTERN extern
#define G_CONST const
#define WEBRTC_INLINE extern __inline
#ifndef WEBRTC_TYPEDEFS_H
#define WEBRTC_TYPEDEFS_H
/* Define WebRtc preprocessor identifiers based on the current build platform */
#if defined(WIN32)
// Windows & Windows Mobile
#if !defined(WEBRTC_TARGET_PC)
#define WEBRTC_TARGET_PC
#endif
#elif defined(__APPLE__)
// Mac OS X
#if defined(__LITTLE_ENDIAN__ ) //TODO: is this used?
#if !defined(WEBRTC_TARGET_MAC_INTEL)
#define WEBRTC_TARGET_MAC_INTEL
#endif
#else
#if !defined(WEBRTC_TARGET_MAC)
#define WEBRTC_TARGET_MAC
#endif
#endif
#else
// Linux etc.
#if !defined(WEBRTC_TARGET_PC)
#define WEBRTC_TARGET_PC
#endif
#endif
#if defined(WEBRTC_TARGET_PC)
#if !defined(_MSC_VER)
#include <stdint.h>
#else
// Define C99 equivalent types.
// Since MSVC doesn't include these headers, we have to write our own
// version to provide a compatibility layer between MSVC and the WebRTC
// headers.
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
#if defined(WIN32)
typedef __int64 WebRtc_Word64;
typedef unsigned __int64 WebRtc_UWord64;
#else
typedef int64_t WebRtc_Word64;
typedef uint64_t WebRtc_UWord64;
#endif
typedef int32_t WebRtc_Word32;
typedef uint32_t WebRtc_UWord32;
typedef int16_t WebRtc_Word16;
typedef uint16_t WebRtc_UWord16;
typedef char WebRtc_Word8;
typedef uint8_t WebRtc_UWord8;
/* Define endian for the platform */
#define WEBRTC_LITTLE_ENDIAN
#elif defined(WEBRTC_TARGET_MAC_INTEL)
#include <stdint.h>
typedef int64_t WebRtc_Word64;
typedef uint64_t WebRtc_UWord64;
typedef int32_t WebRtc_Word32;
typedef uint32_t WebRtc_UWord32;
typedef int16_t WebRtc_Word16;
typedef char WebRtc_Word8;
typedef uint16_t WebRtc_UWord16;
typedef uint8_t WebRtc_UWord8;
/* Define endian for the platform */
#define WEBRTC_LITTLE_ENDIAN
#else
#error "No platform defined for WebRtc type definitions (webrtc_typedefs.h)"
#endif
#endif // WEBRTC_TYPEDEFS_H

View File

@ -0,0 +1,260 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_INTERFACE_ECHO_CANCELLATION_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_INTERFACE_ECHO_CANCELLATION_H_
#include "typedefs.h"
// Errors
#define AEC_UNSPECIFIED_ERROR 12000
#define AEC_UNSUPPORTED_FUNCTION_ERROR 12001
#define AEC_UNINITIALIZED_ERROR 12002
#define AEC_NULL_POINTER_ERROR 12003
#define AEC_BAD_PARAMETER_ERROR 12004
// Warnings
#define AEC_BAD_PARAMETER_WARNING 12050
enum {
kAecNlpConservative = 0,
kAecNlpModerate,
kAecNlpAggressive
};
enum {
kAecFalse = 0,
kAecTrue
};
typedef struct {
WebRtc_Word16 nlpMode; // default kAecNlpModerate
WebRtc_Word16 skewMode; // default kAecFalse
WebRtc_Word16 metricsMode; // default kAecFalse
//float realSkew;
} AecConfig;
typedef struct {
WebRtc_Word16 instant;
WebRtc_Word16 average;
WebRtc_Word16 max;
WebRtc_Word16 min;
} AecLevel;
typedef struct {
AecLevel rerl;
AecLevel erl;
AecLevel erle;
AecLevel aNlp;
} AecMetrics;
#ifdef __cplusplus
extern "C" {
#endif
/*
* Allocates the memory needed by the AEC. The memory needs to be initialized
* separately using the WebRtcAec_Init() function.
*
* Inputs Description
* -------------------------------------------------------------------
* void **aecInst Pointer to the AEC instance to be created
* and initilized
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Create(void **aecInst);
/*
* This function releases the memory allocated by WebRtcAec_Create().
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Free(void *aecInst);
/*
* Initializes an AEC instance.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* WebRtc_Word32 sampFreq Sampling frequency of data
* WebRtc_Word32 scSampFreq Soundcard sampling frequency
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Init(void *aecInst,
WebRtc_Word32 sampFreq,
WebRtc_Word32 scSampFreq);
/*
* Inserts an 80 or 160 sample block of data into the farend buffer.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* WebRtc_Word16 *farend In buffer containing one frame of
* farend signal for L band
* WebRtc_Word16 nrOfSamples Number of samples in farend buffer
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_BufferFarend(void *aecInst,
const WebRtc_Word16 *farend,
WebRtc_Word16 nrOfSamples);
/*
* Runs the echo canceller on an 80 or 160 sample blocks of data.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* WebRtc_Word16 *nearend In buffer containing one frame of
* nearend+echo signal for L band
* WebRtc_Word16 *nearendH In buffer containing one frame of
* nearend+echo signal for H band
* WebRtc_Word16 nrOfSamples Number of samples in nearend buffer
* WebRtc_Word16 msInSndCardBuf Delay estimate for sound card and
* system buffers
* WebRtc_Word16 skew Difference between number of samples played
* and recorded at the soundcard (for clock skew
* compensation)
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word16 *out Out buffer, one frame of processed nearend
* for L band
* WebRtc_Word16 *outH Out buffer, one frame of processed nearend
* for H band
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_Process(void *aecInst,
const WebRtc_Word16 *nearend,
const WebRtc_Word16 *nearendH,
WebRtc_Word16 *out,
WebRtc_Word16 *outH,
WebRtc_Word16 nrOfSamples,
WebRtc_Word16 msInSndCardBuf,
WebRtc_Word32 skew);
/*
* This function enables the user to set certain parameters on-the-fly.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* AecConfig config Config instance that contains all
* properties to be set
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_set_config(void *aecInst, AecConfig config);
/*
* Gets the on-the-fly paramters.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* AecConfig *config Pointer to the config instance that
* all properties will be written to
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_config(void *aecInst, AecConfig *config);
/*
* Gets the current echo status of the nearend signal.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word16 *status 0: Almost certainly nearend single-talk
* 1: Might not be neared single-talk
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_echo_status(void *aecInst, WebRtc_Word16 *status);
/*
* Gets the current echo metrics for the session.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* AecMetrics *metrics Struct which will be filled out with the
* current echo metrics.
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_GetMetrics(void *aecInst, AecMetrics *metrics);
/*
* Gets the last error code.
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word32 return 11000-11100: error code
*/
WebRtc_Word32 WebRtcAec_get_error_code(void *aecInst);
/*
* Gets a version string.
*
* Inputs Description
* -------------------------------------------------------------------
* char *versionStr Pointer to a string array
* WebRtc_Word16 len The maximum length of the string
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word8 *versionStr Pointer to a string array
* WebRtc_Word32 return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_version(WebRtc_Word8 *versionStr, WebRtc_Word16 len);
#ifdef __cplusplus
}
#endif
#endif /* WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_INTERFACE_ECHO_CANCELLATION_H_ */

View File

@ -0,0 +1,124 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_
#include "typedefs.h"
typedef struct NsHandleT NsHandle;
#ifdef __cplusplus
extern "C" {
#endif
/*
* This function returns the version number of the code.
*
* Input:
* - version : Pointer to a character array where the version
* info is stored.
* - length : Length of version.
*
* Return value : 0 - Ok
* -1 - Error (probably length is not sufficient)
*/
int WebRtcNs_get_version(char *version, short length);
/*
* This function creates an instance to the noise reduction structure
*
* Input:
* - NS_inst : Pointer to noise reduction instance that should be
* created
*
* Output:
* - NS_inst : Pointer to created noise reduction instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_Create(NsHandle **NS_inst);
/*
* This function frees the dynamic memory of a specified Noise Reduction
* instance.
*
* Input:
* - NS_inst : Pointer to NS instance that should be freed
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_Free(NsHandle *NS_inst);
/*
* This function initializes a NS instance
*
* Input:
* - NS_inst : Instance that should be initialized
* - fs : sampling frequency
*
* Output:
* - NS_inst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_Init(NsHandle *NS_inst, WebRtc_UWord32 fs);
/*
* This changes the aggressiveness of the noise suppression method.
*
* Input:
* - NS_inst : Instance that should be initialized
* - mode : 0: Mild, 1: Medium , 2: Aggressive
*
* Output:
* - NS_inst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNs_set_policy(NsHandle *NS_inst, int mode);
/*
* This functions does Noise Suppression for the inserted speech frame. The
* input and output signals should always be 10ms (80 or 160 samples).
*
* Input
* - NS_inst : VAD Instance. Needs to be initiated before call.
* - spframe : Pointer to speech frame buffer for L band
* - spframe_H : Pointer to speech frame buffer for H band
* - fs : sampling frequency
*
* Output:
* - NS_inst : Updated NS instance
* - outframe : Pointer to output frame for L band
* - outframe_H : Pointer to output frame for H band
*
* Return value : 0 - OK
* -1 - Error
*/
int WebRtcNs_Process(NsHandle *NS_inst,
short *spframe,
short *spframe_H,
short *outframe,
short *outframe_H);
#ifdef __cplusplus
}
#endif
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_

View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_
#include "signal_processing_library.h"
typedef struct NsxHandleT NsxHandle;
#ifdef __cplusplus
extern "C" {
#endif
/*
* This function returns the version number of the code.
*
* Input:
* - version : Pointer to a character array where the version
* info is stored.
* - length : Length of version.
*
* Return value : 0 - Ok
* -1 - Error (probably length is not sufficient)
*/
int WebRtcNsx_get_version(char *version, short length);
/*
* This function creates an instance to the noise reduction structure
*
* Input:
* - nsxInst : Pointer to noise reduction instance that should be
* created
*
* Output:
* - nsxInst : Pointer to created noise reduction instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_Create(NsxHandle **nsxInst);
/*
* This function frees the dynamic memory of a specified Noise Suppression
* instance.
*
* Input:
* - nsxInst : Pointer to NS instance that should be freed
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_Free(NsxHandle *nsxInst);
/*
* This function initializes a NS instance
*
* Input:
* - nsxInst : Instance that should be initialized
* - fs : sampling frequency
*
* Output:
* - nsxInst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_Init(NsxHandle *nsxInst, WebRtc_UWord32 fs);
/*
* This changes the aggressiveness of the noise suppression method.
*
* Input:
* - nsxInst : Instance that should be initialized
* - mode : 0: Mild, 1: Medium , 2: Aggressive
*
* Output:
* - nsxInst : Initialized instance
*
* Return value : 0 - Ok
* -1 - Error
*/
int WebRtcNsx_set_policy(NsxHandle *nsxInst, int mode);
/*
* This functions does noise suppression for the inserted speech frame. The
* input and output signals should always be 10ms (80 or 160 samples).
*
* Input
* - nsxInst : NSx instance. Needs to be initiated before call.
* - speechFrame : Pointer to speech frame buffer for L band
* - speechFrameHB : Pointer to speech frame buffer for H band
* - fs : sampling frequency
*
* Output:
* - nsxInst : Updated NSx instance
* - outFrame : Pointer to output frame for L band
* - outFrameHB : Pointer to output frame for H band
*
* Return value : 0 - OK
* -1 - Error
*/
int WebRtcNsx_Process(NsxHandle *nsxInst,
short *speechFrame,
short *speechFrameHB,
short *outFrame,
short *outFrameHB);
#ifdef __cplusplus
}
#endif
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
*
* This file contains type definitions used in all WebRtc APIs.
*
*/
/* Reserved words definitions */
#define WEBRTC_EXTERN extern
#define G_CONST const
#define WEBRTC_INLINE extern __inline
#ifndef WEBRTC_TYPEDEFS_H
#define WEBRTC_TYPEDEFS_H
/* Define WebRtc preprocessor identifiers based on the current build platform */
#if defined(WIN32)
// Windows & Windows Mobile
#if !defined(WEBRTC_TARGET_PC)
#define WEBRTC_TARGET_PC
#endif
#elif defined(__APPLE__)
// Mac OS X
#if defined(__LITTLE_ENDIAN__ ) //TODO: is this used?
#if !defined(WEBRTC_TARGET_MAC_INTEL)
#define WEBRTC_TARGET_MAC_INTEL
#endif
#else
#if !defined(WEBRTC_TARGET_MAC)
#define WEBRTC_TARGET_MAC
#endif
#endif
#else
// Linux etc.
#if !defined(WEBRTC_TARGET_PC)
#define WEBRTC_TARGET_PC
#endif
#endif
#if defined(WEBRTC_TARGET_PC)
#if !defined(_MSC_VER)
#include <stdint.h>
#else
// Define C99 equivalent types.
// Since MSVC doesn't include these headers, we have to write our own
// version to provide a compatibility layer between MSVC and the WebRTC
// headers.
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
#if defined(WIN32)
typedef __int64 WebRtc_Word64;
typedef unsigned __int64 WebRtc_UWord64;
#else
typedef int64_t WebRtc_Word64;
typedef uint64_t WebRtc_UWord64;
#endif
typedef int32_t WebRtc_Word32;
typedef uint32_t WebRtc_UWord32;
typedef int16_t WebRtc_Word16;
typedef uint16_t WebRtc_UWord16;
typedef char WebRtc_Word8;
typedef uint8_t WebRtc_UWord8;
/* Define endian for the platform */
#define WEBRTC_LITTLE_ENDIAN
#elif defined(WEBRTC_TARGET_MAC_INTEL)
#include <stdint.h>
typedef int64_t WebRtc_Word64;
typedef uint64_t WebRtc_UWord64;
typedef int32_t WebRtc_Word32;
typedef uint32_t WebRtc_UWord32;
typedef int16_t WebRtc_Word16;
typedef char WebRtc_Word8;
typedef uint16_t WebRtc_UWord16;
typedef uint8_t WebRtc_UWord8;
/* Define endian for the platform */
#define WEBRTC_LITTLE_ENDIAN
#else
#error "No platform defined for WebRtc type definitions (webrtc_typedefs.h)"
#endif
#endif // WEBRTC_TYPEDEFS_H

View File

@ -82,6 +82,18 @@ else
SPEEX_CFLAGS := -DHAVE_LIB_SPEEX=0 SPEEX_CFLAGS := -DHAVE_LIB_SPEEX=0
endif endif
# Google WebRTC (Default: enabled)
ifeq ($(HAVE_WEBRTC), yes)
WEBRTC_CFLAGS := -DHAVE_WEBRTC=1
WEBRTC_LDFLAGS := -lwebrtc_aec_$(MARCH) -lwebrtc_apm_utility_$(MARCH) -lwebrtc_ns_$(MARCH) -lwebrtc_system_wrappers_$(MARCH)
else
WEBRTC_CFLAGS := -DHAVE_WEBRTC=0
endif
ifeq ($(HAVE_WEBRTC_DENOISE), yes)
WEBRTC_CFLAGS += -DHAVE_WEBRTC_DENOISE=1
endif
# ILBC (Default: disabled) # ILBC (Default: disabled)
ifeq ($(ILBC), yes) ifeq ($(ILBC), yes)
@ -122,12 +134,12 @@ endif
################################ ################################
CFLAGS := $(CFLAGS_LIB) -I$(THIRDPARTIES_INC) $(ILBC_CFLAGS) $(LIBGSM_CFLAGS) \ CFLAGS := $(CFLAGS_LIB) -I$(THIRDPARTIES_INC) $(ILBC_CFLAGS) $(LIBGSM_CFLAGS) \
$(FFMPEG_CFLAGS) $(SPEEX_CFLAGS) $(SPEEX_DSP_CFLAGS) $(OPENCORE_AMR_CFLAGS) $(BV16_CFLAGS) $(G729_CFLAGS) \ $(FFMPEG_CFLAGS) $(SPEEX_CFLAGS) $(SPEEX_DSP_CFLAGS) $(WEBRTC_CFLAGS) $(OPENCORE_AMR_CFLAGS) $(BV16_CFLAGS) $(G729_CFLAGS) \
-I../tinySAK/src -I../tinyNET/src -I../tinySDP/include -I../tinyRTP/include -I../tinyMEDIA/include -I../tinyMSRP/include -I./include \ -I../tinySAK/src -I../tinyNET/src -I../tinySDP/include -I../tinyRTP/include -I../tinyMEDIA/include -I../tinyMSRP/include -I./include \
-DJB_HISTORY_SIZE=500 -DJB_HISTORY_SIZE=500
LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) \ LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) \
$(FFMPEG_LDFLAGS) $(SPEEX_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(OPENCORE_AMR_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(BV16_LDFLAGS) $(G729_LDFLAGS)\ $(FFMPEG_LDFLAGS) $(SPEEX_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(WEBRTC_LDFLAGS) $(OPENCORE_AMR_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(BV16_LDFLAGS) $(G729_LDFLAGS)\
-ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -lm -lgcc -ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -lm -lgcc
all: $(APP) all: $(APP)
@ -143,7 +155,8 @@ OBJS += src/audio/tdav_consumer_audio.o \
src/audio/tdav_session_audio.o \ src/audio/tdav_session_audio.o \
src/audio/tdav_speex_denoise.o \ src/audio/tdav_speex_denoise.o \
src/audio/tdav_speex_jitterbuffer.o \ src/audio/tdav_speex_jitterbuffer.o \
src/audio/tdav_speex_resampler.o src/audio/tdav_speex_resampler.o \
src/audio/tdav_webrtc_denoise.o
### video ### video
OBJS += src/video/tdav_converter_video.o \ OBJS += src/video/tdav_converter_video.o \

View File

@ -0,0 +1,79 @@
/*
* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org>
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tdav_webrtc_denoise.h
* @brief Google WebRTC Denoiser (Noise suppression, AGC, AEC) Plugin
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
*/
#ifndef TINYDAV_WEBRTC_DENOISE_H
#define TINYDAV_WEBRTC_DENOISE_H
#include "tinydav_config.h"
#if HAVE_WEBRTC && (!defined(HAVE_WEBRTC_DENOISE) || HAVE_WEBRTC_DENOISE)
#include "tinymedia/tmedia_denoise.h"
#include <webrtc/echo_cancellation.h>
#include <webrtc/noise_suppression.h>
#if !defined(PREFER_SPEEX_DENOISER)
# define PREFER_SPEEX_DENOISER 0
#endif
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER /* Speex denoiser works better than WebRTC's denoiser */
# include <speex/speex_preprocess.h>
#endif
TDAV_BEGIN_DECLS
/** Speex denoiser*/
typedef struct tdav_webrtc_denoise_s
{
TMEDIA_DECLARE_DENOISE;
void *AEC_inst;
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER
SpeexPreprocessState *SpeexDenoiser_proc;
#else
NsHandle *NS_inst;
#endif
uint32_t sound_card_buffer_len;
uint32_t echo_skew;
uint32_t frame_size;
uint32_t sampling_rate;
WebRtc_Word16 *temp_rec_out;
}
tdav_webrtc_denoise_t;
const tmedia_denoise_plugin_def_t *tdav_webrtc_denoise_plugin_def_t;
TDAV_END_DECLS
#endif /* #if HAVE_WEBRTC */
#endif /* TINYDAV_WEBRTC_DENOISE_H */

View File

@ -53,7 +53,7 @@ static int tdav_speex_denoise_open(tmedia_denoise_t* self, uint32_t frame_size,
if(!denoiser->echo_state && TMEDIA_DENOISE(denoiser)->echo_supp_enabled){ if(!denoiser->echo_state && TMEDIA_DENOISE(denoiser)->echo_supp_enabled){
TSK_DEBUG_INFO("Init Aec frame_size[%d] filter_length[%d] SampleRate[%d]", TSK_DEBUG_INFO("Init Aec frame_size[%d] filter_length[%d] SampleRate[%d]",
frame_size* sizeof(spx_int16_t),TMEDIA_DENOISE(denoiser)->echo_tail*frame_size,sampling_rate); frame_size* sizeof(spx_int16_t),TMEDIA_DENOISE(denoiser)->echo_tail*frame_size,sampling_rate);
if((denoiser->echo_state = speex_echo_state_init(frame_size, TMEDIA_DENOISE(denoiser)->echo_tail*frame_size))){ if((denoiser->echo_state = speex_echo_state_init(frame_size, TMEDIA_DENOISE(denoiser)->echo_tail))){
speex_echo_ctl(denoiser->echo_state, SPEEX_ECHO_SET_SAMPLING_RATE, &sampling_rate); speex_echo_ctl(denoiser->echo_state, SPEEX_ECHO_SET_SAMPLING_RATE, &sampling_rate);
} }
} }

View File

@ -0,0 +1,362 @@
/*
* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org>
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tdav_webrtc_denoise.c
* @brief Google WebRTC Denoiser (Noise suppression, AGC, AEC) Plugin
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
*/
#include "tinydav/audio/tdav_webrtc_denoise.h"
#if HAVE_WEBRTC && (!defined(HAVE_WEBRTC_DENOISE) || HAVE_WEBRTC_DENOISE)
#include "tsk_memory.h"
#include "tsk_debug.h"
#include "tinymedia/tmedia_defaults.h"
#include <string.h>
#define WEBRTC_MAX_ECHO_TAIL 500
#if !defined(WEBRTC_HAVE_SPL)
# define WEBRTC_HAVE_SPL 0 // To avoid linking against libspl
#endif
#if !WEBRTC_HAVE_SPL
#define WEBRTC_SPL_MAX_SEED_USED 0x80000000L
static WebRtc_UWord32 WebRtcSpl_IncreaseSeed(WebRtc_UWord32 *seed)
{
seed[0] = (seed[0] * ((WebRtc_Word32)69069) + 1) & (WEBRTC_SPL_MAX_SEED_USED - 1);
return seed[0];
}
static WebRtc_Word16 WebRtcSpl_RandU(WebRtc_UWord32 *seed)
{
return (WebRtc_Word16)(WebRtcSpl_IncreaseSeed(seed) >> 16);
}
// Creates an array of uniformly distributed variables
WebRtc_Word16 WebRtcSpl_RandUArray(WebRtc_Word16* vector,
WebRtc_Word16 vector_length,
WebRtc_UWord32* seed)
{
int i;
for (i = 0; i < vector_length; i++)
{
vector[i] = WebRtcSpl_RandU(seed);
}
return vector_length;
}
#endif /* WEBRTC_HAVE_SPL */
static int tdav_webrtc_denoise_set(tmedia_denoise_t* self, const tmedia_param_t* param)
{
/* tdav_webrtc_denoise_t *denoiser = (tdav_webrtc_denoise_t *)self; */
return tmedia_denoise_set(self, param);
}
static int tdav_webrtc_denoise_open(tmedia_denoise_t* self, uint32_t frame_size, uint32_t sampling_rate)
{
tdav_webrtc_denoise_t *denoiser = (tdav_webrtc_denoise_t *)self;
int ret;
if(!denoiser){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
if(denoiser->AEC_inst ||
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER
denoiser->SpeexDenoiser_proc
#else
denoiser->NS_inst
#endif
){
TSK_DEBUG_ERROR("Denoiser already initialized");
return -2;
}
denoiser->sound_card_buffer_len = TSK_MIN(TMEDIA_DENOISE(denoiser)->echo_tail, WEBRTC_MAX_ECHO_TAIL);
denoiser->echo_skew = TMEDIA_DENOISE(denoiser)->echo_skew;
denoiser->frame_size = frame_size;
denoiser->sampling_rate = sampling_rate;
//
// AEC instance
//
if((ret = WebRtcAec_Create(&denoiser->AEC_inst))){
TSK_DEBUG_ERROR("WebRtcAec_Create failed with error code = %d", ret);
return ret;
}
if((ret = WebRtcAec_Init(denoiser->AEC_inst, denoiser->sampling_rate, denoiser->sampling_rate))){
TSK_DEBUG_ERROR("WebRtcAec_Init failed with error code = %d", ret);
return ret;
}
//
// Noise Suppression instance
//
if(TMEDIA_DENOISE(denoiser)->noise_supp_enabled){
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER
if((denoiser->SpeexDenoiser_proc = speex_preprocess_state_init(denoiser->frame_size, denoiser->sampling_rate))){
int i = 1;
speex_preprocess_ctl(denoiser->SpeexDenoiser_proc, SPEEX_PREPROCESS_SET_DENOISE, &i);
i = TMEDIA_DENOISE(denoiser)->noise_supp_level;
speex_preprocess_ctl(denoiser->SpeexDenoiser_proc, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &i);
}
#else
if((ret = WebRtcNs_Create(&denoiser->NS_inst))){
TSK_DEBUG_ERROR("WebRtcNs_Create failed with error code = %d", ret);
return ret;
}
if((ret = WebRtcNs_Init(denoiser->NS_inst, denoiser->sampling_rate))){
TSK_DEBUG_ERROR("WebRtcNs_Init failed with error code = %d", ret);
return ret;
}
#endif
}
// allocate temp buffer for record processing
if(!(denoiser->temp_rec_out = tsk_realloc(denoiser->temp_rec_out, denoiser->frame_size * sizeof(WebRtc_Word16)))){
TSK_DEBUG_ERROR("Failed to allocate new buffer");
return -3;
}
TSK_DEBUG_INFO("WebRTC denoiser opened");
return ret;
}
static int tdav_webrtc_denoise_echo_playback(tmedia_denoise_t* self, const void* echo_frame)
{
tdav_webrtc_denoise_t *denoiser = (tdav_webrtc_denoise_t *)self;
if(denoiser->AEC_inst){
int ret;
const WebRtc_Word16 *pEchoFrame = (const WebRtc_Word16 *)echo_frame;
switch(denoiser->sampling_rate){
case 8000:
{
if((ret = WebRtcAec_BufferFarend(denoiser->AEC_inst, pEchoFrame, denoiser->frame_size))){
TSK_DEBUG_ERROR("WebRtcAec_BufferFarend failed with error code = %d", ret);
return ret;
}
break;
}
// 32Hz and 16Khz work but produce very ugly results
case 16000:
case 32000:
{
uint32_t i;
for(i = 0; i<denoiser->frame_size; i+=denoiser->frame_size/2){
if((ret = WebRtcAec_BufferFarend(denoiser->AEC_inst, &pEchoFrame[i], denoiser->frame_size/2))){
TSK_DEBUG_ERROR("WebRtcAec_BufferFarend failed with error code = %d", ret);
return ret;
}
}
break;
}
default:
{
TSK_DEBUG_ERROR("%d Hz not supported by WebRTC AEC", denoiser->sampling_rate);
return -2;
}
}
}
return 0;
}
static int tdav_webrtc_denoise_process_record(tmedia_denoise_t* self, void* audio_frame, tsk_bool_t* silence_or_noise)
{
tdav_webrtc_denoise_t *denoiser = (tdav_webrtc_denoise_t *)self;
*silence_or_noise = tsk_false;
if(denoiser->AEC_inst){
int ret;
WebRtc_Word16 *pAudioFrame = audio_frame;
// Noise suppression
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER
speex_preprocess_run(denoiser->SpeexDenoiser_proc, pAudioFrame);
#else
// WebRTC NoiseSupp only accept 10ms frames
// Our encoder will always output 20ms frames ==> execute 2x noise_supp
if(
(ret = WebRtcNs_Process(denoiser->NS_inst, pAudioFrame, tsk_null, denoiser->temp_rec_out, tsk_null)) ||
(ret = WebRtcNs_Process(denoiser->NS_inst, &pAudioFrame[denoiser->frame_size/2], tsk_null, &denoiser->temp_rec_out[denoiser->frame_size/2], tsk_null))
)
{
TSK_DEBUG_ERROR("WebRtcNs_Process with error code = %d", ret);
return ret;
}
#endif
// AEC
switch(denoiser->sampling_rate){
case 8000:
{
if((ret = WebRtcAec_Process(denoiser->AEC_inst, denoiser->temp_rec_out, tsk_null, pAudioFrame, tsk_null, denoiser->frame_size, denoiser->sound_card_buffer_len, denoiser->echo_skew))){
TSK_DEBUG_ERROR("WebRtcAec_Process with error code = %d", ret);
return ret;
}
break;
}
// 32Hz and 16Khz work but produce very ugly results
case 16000:
case 3200:
{
uint32_t i;
for(i = 0; i<denoiser->frame_size; i+=denoiser->frame_size/2){
if((ret = WebRtcAec_Process(denoiser->AEC_inst, &denoiser->temp_rec_out[i], tsk_null, &pAudioFrame[i], tsk_null, denoiser->frame_size/2, denoiser->sound_card_buffer_len, denoiser->echo_skew))){
TSK_DEBUG_ERROR("WebRtcAec_Process with error code = %d", ret);
return ret;
}
}
break;
}
default:
{
TSK_DEBUG_ERROR("%d Hz not supported by WebRTC AEC", denoiser->sampling_rate);
return -2;
}
}
}
return 0;
}
WebRtc_Word16 test[];
static int tdav_webrtc_denoise_process_playback(tmedia_denoise_t* self, void* audio_frame)
{
tdav_webrtc_denoise_t *denoiser = (tdav_webrtc_denoise_t *)self;
// Not mandatory but we could denoise the audio data sent from an encoder without denoiser
// All Doubango clients support noise suppression
return 0;
}
static int tdav_webrtc_denoise_close(tmedia_denoise_t* self)
{
tdav_webrtc_denoise_t *denoiser = (tdav_webrtc_denoise_t *)self;
if(denoiser->AEC_inst){
WebRtcAec_Free(denoiser->AEC_inst);
denoiser->AEC_inst = tsk_null;
}
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER
if(denoiser->SpeexDenoiser_proc){
speex_preprocess_state_destroy(denoiser->SpeexDenoiser_proc);
denoiser->SpeexDenoiser_proc = tsk_null;
}
#else
if(denoiser->NS_inst){
WebRtcNs_Free(denoiser->NS_inst);
denoiser->NS_inst = tsk_null;
}
#endif
TSK_FREE(denoiser->temp_rec_out);
return 0;
}
//
// Speex denoiser Plugin definition
//
/* constructor */
static tsk_object_t* tdav_webrtc_denoise_ctor(tsk_object_t * self, va_list * app)
{
tdav_webrtc_denoise_t *denoise = self;
if(denoise){
/* init base */
tmedia_denoise_init(TMEDIA_DENOISE(denoise));
/* init self */
}
return self;
}
/* destructor */
static tsk_object_t* tdav_webrtc_denoise_dtor(tsk_object_t * self)
{
tdav_webrtc_denoise_t *denoise = self;
if(denoise){
/* deinit base */
tmedia_denoise_deinit(TMEDIA_DENOISE(denoise));
/* deinit self */
if(denoise->AEC_inst){
WebRtcAec_Free(denoise->AEC_inst);
denoise->AEC_inst = tsk_null;
}
#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER
if(denoise->SpeexDenoiser_proc){
speex_preprocess_state_destroy(denoise->SpeexDenoiser_proc);
denoise->SpeexDenoiser_proc = tsk_null;
}
#else
if(denoise->NS_inst){
WebRtcNs_Free(denoise->NS_inst);
denoise->NS_inst = tsk_null;
}
#endif
TSK_FREE(denoise->temp_rec_out);
}
return self;
}
/* object definition */
static const tsk_object_def_t tdav_webrtc_denoise_def_s =
{
sizeof(tdav_webrtc_denoise_t),
tdav_webrtc_denoise_ctor,
tdav_webrtc_denoise_dtor,
tsk_null,
};
/* plugin definition*/
static const tmedia_denoise_plugin_def_t tdav_webrtc_denoise_plugin_def_s =
{
&tdav_webrtc_denoise_def_s,
"Audio Denoiser based on Google WebRTC",
tdav_webrtc_denoise_set,
tdav_webrtc_denoise_open,
tdav_webrtc_denoise_echo_playback,
tdav_webrtc_denoise_process_record,
tdav_webrtc_denoise_process_playback,
tdav_webrtc_denoise_close,
};
const tmedia_denoise_plugin_def_t *tdav_webrtc_denoise_plugin_def_t = &tdav_webrtc_denoise_plugin_def_s;
#endif /* HAVE_WEBRTC */

View File

@ -81,6 +81,9 @@
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE) #if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE)
# include "tinydav/audio/tdav_speex_denoise.h" # include "tinydav/audio/tdav_speex_denoise.h"
#endif #endif
#if HAVE_WEBRTC && (!defined(HAVE_WEBRTC_DENOISE) || HAVE_WEBRTC_DENOISE)
# include "tinydav/audio/tdav_webrtc_denoise.h"
#endif
// Audio resampler // Audio resampler
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER) #if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER)
@ -227,6 +230,9 @@ int tdav_init()
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE) #if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE)
tmedia_denoise_plugin_register(tdav_speex_denoise_plugin_def_t); tmedia_denoise_plugin_register(tdav_speex_denoise_plugin_def_t);
#endif #endif
#if HAVE_WEBRTC && (!defined(HAVE_WEBRTC_DENOISE) || HAVE_WEBRTC_DENOISE)
tmedia_denoise_plugin_register(tdav_webrtc_denoise_plugin_def_t);
#endif
/* === Register Audio Resampler === */ /* === Register Audio Resampler === */
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER) #if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER)
@ -494,6 +500,9 @@ int tdav_deinit()
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE) #if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE)
tmedia_denoise_plugin_unregister(tdav_speex_denoise_plugin_def_t); tmedia_denoise_plugin_unregister(tdav_speex_denoise_plugin_def_t);
#endif #endif
#if HAVE_WEBRTC && (!defined(HAVE_WEBRTC_DENOISE) || HAVE_WEBRTC_DENOISE)
tmedia_denoise_plugin_unregister(tdav_webrtc_denoise_plugin_def_t);
#endif
/* === UnRegister Audio Resampler === */ /* === UnRegister Audio Resampler === */
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER) #if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER)

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="&quot;$(PSDK_DIR)include&quot;;&quot;$(DXSDK_DIR)include&quot;;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinySDP\include;..\tinyNET\src;..\tinyDSHOW\include;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16" AdditionalIncludeDirectories="&quot;$(PSDK_DIR)include&quot;;&quot;$(DXSDK_DIR)include&quot;;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinySDP\include;..\tinyNET\src;..\tinyDSHOW\include;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16"
PreprocessorDefinitions="HAVE_G729=0;HAVE_BV16=0;HAVE_OPENCORE_AMR=1;HAVE_ILBC=0;HAVE_LIBGSM=1;HAVE_TINYDSHOW=1;HAVE_DSOUND_H=1;HAVE_WAVE_API=0;HAVE_FFMPEG=1;HAVE_SPEEX_DSP=1;HAVE_SPEEX_JB=1;HAVE_LIB_SPEEX=1;G192BITSTREAM=0;DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;_WIN32_WINNT=0x0501;TINYDAV_EXPORTS" PreprocessorDefinitions="HAVE_G729=0;HAVE_BV16=0;HAVE_OPENCORE_AMR=1;HAVE_ILBC=0;HAVE_LIBGSM=1;HAVE_TINYDSHOW=1;HAVE_DSOUND_H=1;HAVE_WAVE_API=0;HAVE_FFMPEG=1;HAVE_SPEEX_DSP=1;HAVE_WEBRTC=1;HAVE_SPEEX_JB=1;HAVE_LIB_SPEEX=1;G192BITSTREAM=0;DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;_WIN32_WINNT=0x0501;TINYDAV_EXPORTS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -64,9 +64,9 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinyMSRP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib $(OutDir)\tinyDSHOW.lib &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; ..\thirdparties\win32\lib\libgcc.a ..\thirdparties\win32\lib\libmingwex.a &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavcore.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot;" AdditionalDependencies="Winmm.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinyMSRP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib $(OutDir)\tinyDSHOW.lib &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; ..\thirdparties\win32\lib\libgcc.a ..\thirdparties\win32\lib\libmingwex.a &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavcore.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\webrtc\aec.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\apm_util.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\system_wrappers.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\ns.lib&quot;"
LinkIncremental="2" LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT" IgnoreDefaultLibraryNames="MSVCRT;LIBCMTD;LIBCMT"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
RandomizedBaseAddress="1" RandomizedBaseAddress="1"
@ -122,7 +122,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
EnableIntrinsicFunctions="false" EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="&quot;$(PSDK_DIR)include&quot;;&quot;$(DXSDK_DIR)include&quot;;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinySDP\include;..\tinyNET\src;..\tinyDSHOW\include;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16" AdditionalIncludeDirectories="&quot;$(PSDK_DIR)include&quot;;&quot;$(DXSDK_DIR)include&quot;;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinySDP\include;..\tinyNET\src;..\tinyDSHOW\include;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYDAV_EXPORTS;DEBUG_LEVEL=DEBUG_LEVEL_INFOS;HAVE_G729=0;HAVE_BV16=0;HAVE_OPENCORE_AMR=1;HAVE_ILBC=0;HAVE_LIBGSM=1;HAVE_TINYDSHOW=1;HAVE_DSOUND_H=1;HAVE_WAVE_API=0;HAVE_FFMPEG=1;HAVE_SPEEX_DSP=1;HAVE_SPEEX_JB=1;HAVE_LIB_SPEEX=1;G192BITSTREAM=0;_WIN32_WINNT=0x0501" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYDAV_EXPORTS;DEBUG_LEVEL=DEBUG_LEVEL_INFOS;HAVE_G729=0;HAVE_BV16=0;HAVE_OPENCORE_AMR=1;HAVE_ILBC=0;HAVE_LIBGSM=1;HAVE_TINYDSHOW=1;HAVE_DSOUND_H=1;HAVE_WAVE_API=0;HAVE_FFMPEG=1;HAVE_SPEEX_DSP=1;HAVE_WEBRTC=1;HAVE_SPEEX_JB=1;HAVE_LIB_SPEEX=1;G192BITSTREAM=0;_WIN32_WINNT=0x0501"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="false" EnableFunctionLevelLinking="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@ -143,9 +143,9 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinyMSRP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib $(OutDir)\tinyDSHOW.lib &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; ..\thirdparties\win32\lib\libgcc.a ..\thirdparties\win32\lib\libmingwex.a &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavcore.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\BroadVoice16\libbv16.a&quot; &quot;..\thirdparties\win32\lib\opencore\libopencore-amrnb.a&quot;" AdditionalDependencies="Winmm.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinyMSRP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib $(OutDir)\tinyDSHOW.lib &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; ..\thirdparties\win32\lib\libgcc.a ..\thirdparties\win32\lib\libmingwex.a &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavcore.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\BroadVoice16\libbv16.a&quot; &quot;..\thirdparties\win32\lib\opencore\libopencore-amrnb.a&quot; &quot;..\thirdparties\win32\lib\webrtc\aec.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\apm_util.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\system_wrappers.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\ns.lib&quot;"
LinkIncremental="1" LinkIncremental="1"
IgnoreDefaultLibraryNames="MSVCRTD" IgnoreDefaultLibraryNames="MSVCRTD;LIBCMT"
GenerateDebugInformation="false" GenerateDebugInformation="false"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
@ -370,6 +370,10 @@
RelativePath=".\include\tinydav\audio\tdav_speex_resampler.h" RelativePath=".\include\tinydav\audio\tdav_speex_resampler.h"
> >
</File> </File>
<File
RelativePath=".\include\tinydav\audio\tdav_webrtc_denoise.h"
>
</File>
<Filter <Filter
Name="android" Name="android"
> >
@ -654,6 +658,10 @@
RelativePath=".\src\audio\tdav_speex_resampler.c" RelativePath=".\src\audio\tdav_speex_resampler.c"
> >
</File> </File>
<File
RelativePath=".\src\audio\tdav_webrtc_denoise.c"
>
</File>
<Filter <Filter
Name="android" Name="android"
> >

View File

@ -38,7 +38,9 @@ TINYMEDIA_API tmedia_bandwidth_level_t tmedia_defaults_get_bl();
// Denoiser: Echo suppression, AEC, Noise redution, AGC, ... // Denoiser: Echo suppression, AEC, Noise redution, AGC, ...
// //
TINYMEDIA_API int tmedia_defaults_set_echo_tail(uint32_t echo_tail); TINYMEDIA_API int tmedia_defaults_set_echo_tail(uint32_t echo_tail);
TINYMEDIA_API int tmedia_defaults_set_echo_skew(uint32_t echo_skew);
TINYMEDIA_API uint32_t tmedia_defaults_get_echo_tail(); TINYMEDIA_API uint32_t tmedia_defaults_get_echo_tail();
TINYMEDIA_API uint32_t tmedia_defaults_get_echo_skew();
TINYMEDIA_API int tmedia_defaults_set_echo_supp_enabled(tsk_bool_t echo_supp_enabled); TINYMEDIA_API int tmedia_defaults_set_echo_supp_enabled(tsk_bool_t echo_supp_enabled);
TINYMEDIA_API tsk_bool_t tmedia_defaults_get_echo_supp_enabled(); TINYMEDIA_API tsk_bool_t tmedia_defaults_get_echo_supp_enabled();
TINYMEDIA_API int tmedia_defaults_set_agc_enabled(tsk_bool_t agc_enabled); TINYMEDIA_API int tmedia_defaults_set_agc_enabled(tsk_bool_t agc_enabled);

View File

@ -46,6 +46,7 @@ typedef struct tmedia_denoise_s
tsk_bool_t opened; tsk_bool_t opened;
uint32_t echo_tail; uint32_t echo_tail;
uint32_t echo_skew;
tsk_bool_t echo_supp_enabled; tsk_bool_t echo_supp_enabled;
tsk_bool_t agc_enabled ; tsk_bool_t agc_enabled ;
float agc_level; float agc_level;

View File

@ -45,6 +45,7 @@ tmedia_bandwidth_level_t tmedia_defaults_get_bl()
// Denoiser: Echo suppression, AEC, Noise redution, AGC, ... // Denoiser: Echo suppression, AEC, Noise redution, AGC, ...
// //
static uint32_t __echo_tail = 20; static uint32_t __echo_tail = 20;
static uint32_t __echo_skew = 0;
static tsk_bool_t __echo_supp_enabled; static tsk_bool_t __echo_supp_enabled;
static tsk_bool_t __agc_enabled = tsk_false; static tsk_bool_t __agc_enabled = tsk_false;
static float __agc_level = 8000.0f; static float __agc_level = 8000.0f;
@ -61,11 +62,22 @@ int tmedia_defaults_set_echo_tail(uint32_t echo_tail)
return 0; return 0;
} }
int tmedia_defaults_set_echo_skew(uint32_t echo_skew)
{
__echo_skew = echo_skew;
return 0;
}
uint32_t tmedia_defaults_get_echo_tail() uint32_t tmedia_defaults_get_echo_tail()
{ {
return __echo_tail; return __echo_tail;
} }
uint32_t tmedia_defaults_get_echo_skew()
{
return __echo_skew;
}
int tmedia_defaults_set_echo_supp_enabled(tsk_bool_t echo_supp_enabled) int tmedia_defaults_set_echo_supp_enabled(tsk_bool_t echo_supp_enabled)
{ {
__echo_supp_enabled = echo_supp_enabled; __echo_supp_enabled = echo_supp_enabled;

View File

@ -42,6 +42,7 @@ int tmedia_denoise_init(tmedia_denoise_t* self)
} }
self->echo_tail = tmedia_defaults_get_echo_tail(); self->echo_tail = tmedia_defaults_get_echo_tail();
self->echo_skew = tmedia_defaults_get_echo_skew();
self->echo_supp_enabled = tmedia_defaults_get_echo_supp_enabled(); self->echo_supp_enabled = tmedia_defaults_get_echo_supp_enabled();
self->agc_enabled = tmedia_defaults_get_agc_enabled(); self->agc_enabled = tmedia_defaults_get_agc_enabled();
self->agc_level = tmedia_defaults_get_agc_level(); self->agc_level = tmedia_defaults_get_agc_level();

View File

@ -344,7 +344,6 @@ tmedia_codecs_L_t* tmedia_session_match_codec(tmedia_session_t* self, const tsdp
// Guard to avoid matching a codec more than once // Guard to avoid matching a codec more than once
// For example, H.264 codecs without profiles (Jetsi,Tiscali PC client) to distinguish them could match more than once // For example, H.264 codecs without profiles (Jetsi,Tiscali PC client) to distinguish them could match more than once
if(matchingCodecs && tsk_list_find_object_by_pred(matchingCodecs, __pred_find_codec_by_format, codec)){ if(matchingCodecs && tsk_list_find_object_by_pred(matchingCodecs, __pred_find_codec_by_format, codec)){
TSK_DEBUG_WARN("Codec already matched. Try to add valid FMTP to your codec to help matching.");
continue; continue;
} }