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
|
// Optional setting of typing detection parameters
|
||||||
// Parameter with value == 0 will be ignored
|
// Parameter with value == 0 will be ignored
|
||||||
|
|
||||||
// and left with default config.
|
// and left with default config.
|
||||||
virtual int SetTypingDetectionParameters(int timeWindow,
|
virtual int SetTypingDetectionParameters(int timeWindow,
|
||||||
int costPerTyping,
|
int costPerTyping,
|
||||||
int reportingThreshold,
|
int reportingThreshold,
|
||||||
int penaltyDecay) = 0;
|
int penaltyDecay,
|
||||||
|
int typeEventDelay) = 0;
|
||||||
|
|
||||||
// Swaps the capture-side left and right audio channels when enabled. It
|
// 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
|
// 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
|
_costPerTyping(100), // Penalty added for a typing + activity coincide
|
||||||
_reportingThreshold(300), // Threshold for _penaltyCounter
|
_reportingThreshold(300), // Threshold for _penaltyCounter
|
||||||
_penaltyDecay(1), // how much we reduce _penaltyCounter every 10 ms.
|
_penaltyDecay(1), // how much we reduce _penaltyCounter every 10 ms.
|
||||||
|
_typeEventDelay(2), // how "old" event we check for
|
||||||
#endif
|
#endif
|
||||||
_saturationWarning(0),
|
_saturationWarning(0),
|
||||||
_noiseWarning(0),
|
_noiseWarning(0),
|
||||||
@ -1373,6 +1374,7 @@ WebRtc_Word32 TransmitMixer::APMProcessStream(
|
|||||||
#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||||
int TransmitMixer::TypingDetection()
|
int TransmitMixer::TypingDetection()
|
||||||
{
|
{
|
||||||
|
|
||||||
// We let the VAD determine if we're using this feature or not.
|
// We let the VAD determine if we're using this feature or not.
|
||||||
if (_audioFrame.vad_activity_ == AudioFrame::kVadUnknown)
|
if (_audioFrame.vad_activity_ == AudioFrame::kVadUnknown)
|
||||||
{
|
{
|
||||||
@ -1401,7 +1403,8 @@ int TransmitMixer::TypingDetection()
|
|||||||
++_timeSinceLastTyping;
|
++_timeSinceLastTyping;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyPressed && (_audioFrame.vad_activity_ == AudioFrame::kVadActive)
|
if ((_timeSinceLastTyping < _typeEventDelay)
|
||||||
|
&& (_audioFrame.vad_activity_ == AudioFrame::kVadActive)
|
||||||
&& (_timeActive < _timeWindow))
|
&& (_timeActive < _timeWindow))
|
||||||
{
|
{
|
||||||
_penaltyCounter += _costPerTyping;
|
_penaltyCounter += _costPerTyping;
|
||||||
@ -1452,7 +1455,8 @@ int TransmitMixer::TimeSinceLastTyping(int &seconds)
|
|||||||
int TransmitMixer::SetTypingDetectionParameters(int timeWindow,
|
int TransmitMixer::SetTypingDetectionParameters(int timeWindow,
|
||||||
int costPerTyping,
|
int costPerTyping,
|
||||||
int reportingThreshold,
|
int reportingThreshold,
|
||||||
int penaltyDecay)
|
int penaltyDecay,
|
||||||
|
int typeEventDelay)
|
||||||
{
|
{
|
||||||
if(timeWindow != 0)
|
if(timeWindow != 0)
|
||||||
_timeWindow = timeWindow;
|
_timeWindow = timeWindow;
|
||||||
@ -1462,6 +1466,9 @@ int TransmitMixer::SetTypingDetectionParameters(int timeWindow,
|
|||||||
_reportingThreshold = reportingThreshold;
|
_reportingThreshold = reportingThreshold;
|
||||||
if(penaltyDecay != 0)
|
if(penaltyDecay != 0)
|
||||||
_penaltyDecay = penaltyDecay;
|
_penaltyDecay = penaltyDecay;
|
||||||
|
if(_typeEventDelay != 0)
|
||||||
|
_penaltyDecay = _typeEventDelay;
|
||||||
|
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,8 @@ public:
|
|||||||
int SetTypingDetectionParameters(int timeWindow,
|
int SetTypingDetectionParameters(int timeWindow,
|
||||||
int costPerTyping,
|
int costPerTyping,
|
||||||
int reportingThreshold,
|
int reportingThreshold,
|
||||||
int penaltyDecay);
|
int penaltyDecay,
|
||||||
|
int typeEventDelay);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void EnableStereoChannelSwapping(bool enable);
|
void EnableStereoChannelSwapping(bool enable);
|
||||||
@ -217,6 +218,7 @@ private:
|
|||||||
int _costPerTyping; // Penalty added for a typing + activity coincide.
|
int _costPerTyping; // Penalty added for a typing + activity coincide.
|
||||||
int _reportingThreshold; // Threshold for _penaltyCounter.
|
int _reportingThreshold; // Threshold for _penaltyCounter.
|
||||||
int _penaltyDecay; // How much we reduce _penaltyCounter every 10 ms.
|
int _penaltyDecay; // How much we reduce _penaltyCounter every 10 ms.
|
||||||
|
int _typeEventDelay; // How old typing events we allow
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
WebRtc_UWord32 _saturationWarning;
|
WebRtc_UWord32 _saturationWarning;
|
||||||
|
@ -1077,7 +1077,8 @@ int VoEAudioProcessingImpl::TimeSinceLastTyping(int &seconds) {
|
|||||||
int VoEAudioProcessingImpl::SetTypingDetectionParameters(int timeWindow,
|
int VoEAudioProcessingImpl::SetTypingDetectionParameters(int timeWindow,
|
||||||
int costPerTyping,
|
int costPerTyping,
|
||||||
int reportingThreshold,
|
int reportingThreshold,
|
||||||
int penaltyDecay) {
|
int penaltyDecay,
|
||||||
|
int typeEventDelay) {
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
"SetTypingDetectionParameters()");
|
"SetTypingDetectionParameters()");
|
||||||
ANDROID_NOT_SUPPORTED(_shared->statistics());
|
ANDROID_NOT_SUPPORTED(_shared->statistics());
|
||||||
@ -1089,7 +1090,7 @@ int VoEAudioProcessingImpl::SetTypingDetectionParameters(int timeWindow,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (_shared->transmit_mixer()->SetTypingDetectionParameters(timeWindow,
|
return (_shared->transmit_mixer()->SetTypingDetectionParameters(timeWindow,
|
||||||
costPerTyping, reportingThreshold, penaltyDecay));
|
costPerTyping, reportingThreshold, penaltyDecay, typeEventDelay));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
_shared->statistics().SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
|
_shared->statistics().SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
|
||||||
|
@ -91,7 +91,8 @@ class VoEAudioProcessingImpl : public VoEAudioProcessing {
|
|||||||
virtual int SetTypingDetectionParameters(int timeWindow,
|
virtual int SetTypingDetectionParameters(int timeWindow,
|
||||||
int costPerTyping,
|
int costPerTyping,
|
||||||
int reportingThreshold,
|
int reportingThreshold,
|
||||||
int penaltyDecay);
|
int penaltyDecay,
|
||||||
|
int typeEventDelay);
|
||||||
|
|
||||||
virtual void EnableStereoChannelSwapping(bool enable);
|
virtual void EnableStereoChannelSwapping(bool enable);
|
||||||
virtual bool IsStereoChannelSwappingEnabled();
|
virtual bool IsStereoChannelSwappingEnabled();
|
||||||
|
Loading…
Reference in New Issue
Block a user