Adding one parameter to typing detection tuning
Review URL: https://webrtc-codereview.appspot.com/569009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2203 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9f49af9cea
commit
f6edfeff63
@ -200,11 +200,13 @@ public:
|
||||
|
||||
// Optional setting of typing detection parameters
|
||||
// Parameter with value == 0 will be ignored
|
||||
|
||||
// and left with default config.
|
||||
virtual int SetTypingDetectionParameters(int timeWindow,
|
||||
int costPerTyping,
|
||||
int reportingThreshold,
|
||||
int penaltyDecay) = 0;
|
||||
int penaltyDecay,
|
||||
int typeEventDelay) = 0;
|
||||
|
||||
// Swaps the capture-side left and right audio channels when enabled. It
|
||||
// only has an effect when using a stereo send codec. The setting is
|
||||
|
@ -190,6 +190,7 @@ TransmitMixer::TransmitMixer(const WebRtc_UWord32 instanceId) :
|
||||
_costPerTyping(100), // Penalty added for a typing + activity coincide
|
||||
_reportingThreshold(300), // Threshold for _penaltyCounter
|
||||
_penaltyDecay(1), // how much we reduce _penaltyCounter every 10 ms.
|
||||
_typeEventDelay(2), // how "old" event we check for
|
||||
#endif
|
||||
_saturationWarning(0),
|
||||
_noiseWarning(0),
|
||||
@ -1373,6 +1374,7 @@ WebRtc_Word32 TransmitMixer::APMProcessStream(
|
||||
#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
int TransmitMixer::TypingDetection()
|
||||
{
|
||||
|
||||
// We let the VAD determine if we're using this feature or not.
|
||||
if (_audioFrame.vad_activity_ == AudioFrame::kVadUnknown)
|
||||
{
|
||||
@ -1401,7 +1403,8 @@ int TransmitMixer::TypingDetection()
|
||||
++_timeSinceLastTyping;
|
||||
}
|
||||
|
||||
if (keyPressed && (_audioFrame.vad_activity_ == AudioFrame::kVadActive)
|
||||
if ((_timeSinceLastTyping < _typeEventDelay)
|
||||
&& (_audioFrame.vad_activity_ == AudioFrame::kVadActive)
|
||||
&& (_timeActive < _timeWindow))
|
||||
{
|
||||
_penaltyCounter += _costPerTyping;
|
||||
@ -1452,7 +1455,8 @@ int TransmitMixer::TimeSinceLastTyping(int &seconds)
|
||||
int TransmitMixer::SetTypingDetectionParameters(int timeWindow,
|
||||
int costPerTyping,
|
||||
int reportingThreshold,
|
||||
int penaltyDecay)
|
||||
int penaltyDecay,
|
||||
int typeEventDelay)
|
||||
{
|
||||
if(timeWindow != 0)
|
||||
_timeWindow = timeWindow;
|
||||
@ -1462,6 +1466,9 @@ int TransmitMixer::SetTypingDetectionParameters(int timeWindow,
|
||||
_reportingThreshold = reportingThreshold;
|
||||
if(penaltyDecay != 0)
|
||||
_penaltyDecay = penaltyDecay;
|
||||
if(_typeEventDelay != 0)
|
||||
_penaltyDecay = _typeEventDelay;
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -154,7 +154,8 @@ public:
|
||||
int SetTypingDetectionParameters(int timeWindow,
|
||||
int costPerTyping,
|
||||
int reportingThreshold,
|
||||
int penaltyDecay);
|
||||
int penaltyDecay,
|
||||
int typeEventDelay);
|
||||
#endif
|
||||
|
||||
void EnableStereoChannelSwapping(bool enable);
|
||||
@ -217,6 +218,7 @@ private:
|
||||
int _costPerTyping; // Penalty added for a typing + activity coincide.
|
||||
int _reportingThreshold; // Threshold for _penaltyCounter.
|
||||
int _penaltyDecay; // How much we reduce _penaltyCounter every 10 ms.
|
||||
int _typeEventDelay; // How old typing events we allow
|
||||
|
||||
#endif
|
||||
WebRtc_UWord32 _saturationWarning;
|
||||
|
@ -1077,7 +1077,8 @@ int VoEAudioProcessingImpl::TimeSinceLastTyping(int &seconds) {
|
||||
int VoEAudioProcessingImpl::SetTypingDetectionParameters(int timeWindow,
|
||||
int costPerTyping,
|
||||
int reportingThreshold,
|
||||
int penaltyDecay) {
|
||||
int penaltyDecay,
|
||||
int typeEventDelay) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"SetTypingDetectionParameters()");
|
||||
ANDROID_NOT_SUPPORTED(_shared->statistics());
|
||||
@ -1089,7 +1090,7 @@ int VoEAudioProcessingImpl::SetTypingDetectionParameters(int timeWindow,
|
||||
return -1;
|
||||
}
|
||||
return (_shared->transmit_mixer()->SetTypingDetectionParameters(timeWindow,
|
||||
costPerTyping, reportingThreshold, penaltyDecay));
|
||||
costPerTyping, reportingThreshold, penaltyDecay, typeEventDelay));
|
||||
|
||||
#else
|
||||
_shared->statistics().SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
|
||||
|
@ -91,7 +91,8 @@ class VoEAudioProcessingImpl : public VoEAudioProcessing {
|
||||
virtual int SetTypingDetectionParameters(int timeWindow,
|
||||
int costPerTyping,
|
||||
int reportingThreshold,
|
||||
int penaltyDecay);
|
||||
int penaltyDecay,
|
||||
int typeEventDelay);
|
||||
|
||||
virtual void EnableStereoChannelSwapping(bool enable);
|
||||
virtual bool IsStereoChannelSwappingEnabled();
|
||||
|
Loading…
Reference in New Issue
Block a user