Remove saturation warning support from TransmitMixer.
BUG=none Review-Url: https://codereview.webrtc.org/2720253002 Cr-Commit-Position: refs/heads/master@{#16913}
This commit is contained in:
parent
e3e902eef9
commit
ba08a140da
@ -80,7 +80,6 @@
|
||||
#define VE_RECEIVE_SOCKETS_CONFLICT 8105
|
||||
#define VE_SEND_SOCKETS_CONFLICT 8106
|
||||
#define VE_TYPING_NOISE_WARNING 8107
|
||||
#define VE_SATURATION_WARNING 8108
|
||||
#define VE_NOISE_WARNING 8109
|
||||
#define VE_CANNOT_GET_SEND_CODEC 8110
|
||||
#define VE_CANNOT_GET_REC_CODEC 8111
|
||||
|
||||
@ -81,8 +81,6 @@ void MyObserver::CallbackOnError(int channel, int err_code) {
|
||||
printf(" RUNTIME PLAY WARNING \n");
|
||||
} else if (err_code == VE_RUNTIME_REC_WARNING) {
|
||||
printf(" RUNTIME RECORD WARNING \n");
|
||||
} else if (err_code == VE_SATURATION_WARNING) {
|
||||
printf(" SATURATION WARNING \n");
|
||||
} else if (err_code == VE_RUNTIME_PLAY_ERROR) {
|
||||
printf(" RUNTIME PLAY ERROR \n");
|
||||
} else if (err_code == VE_RUNTIME_REC_ERROR) {
|
||||
|
||||
@ -26,14 +26,13 @@
|
||||
namespace webrtc {
|
||||
namespace voe {
|
||||
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
// TODO(ajm): The thread safety of this is dubious...
|
||||
void
|
||||
TransmitMixer::OnPeriodicProcess()
|
||||
void TransmitMixer::OnPeriodicProcess()
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
|
||||
"TransmitMixer::OnPeriodicProcess()");
|
||||
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
bool send_typing_noise_warning = false;
|
||||
bool typing_noise_detected = false;
|
||||
{
|
||||
@ -64,32 +63,8 @@ TransmitMixer::OnPeriodicProcess()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
|
||||
bool saturationWarning = false;
|
||||
{
|
||||
// Modify |_saturationWarning| under lock to avoid conflict with write op
|
||||
// in ProcessAudio and also ensure that we don't hold the lock during the
|
||||
// callback.
|
||||
rtc::CritScope cs(&_critSect);
|
||||
saturationWarning = _saturationWarning;
|
||||
if (_saturationWarning)
|
||||
_saturationWarning = false;
|
||||
}
|
||||
|
||||
if (saturationWarning)
|
||||
{
|
||||
rtc::CritScope cs(&_callbackCritSect);
|
||||
if (_voiceEngineObserverPtr)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
||||
"TransmitMixer::OnPeriodicProcess() =>"
|
||||
" CallbackOnError(VE_SATURATION_WARNING)");
|
||||
_voiceEngineObserverPtr->CallbackOnError(-1, VE_SATURATION_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
|
||||
void TransmitMixer::PlayNotification(int32_t id,
|
||||
uint32_t durationMs)
|
||||
@ -176,12 +151,14 @@ TransmitMixer::Destroy(TransmitMixer*& mixer)
|
||||
}
|
||||
|
||||
TransmitMixer::TransmitMixer(uint32_t instanceId) :
|
||||
_monitorModule(this),
|
||||
// Avoid conflict with other channels by adding 1024 - 1026,
|
||||
// won't use as much as 1024 channels.
|
||||
_filePlayerId(instanceId + 1024),
|
||||
_fileRecorderId(instanceId + 1025),
|
||||
_fileCallRecorderId(instanceId + 1026),
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
_monitorModule(this),
|
||||
#endif
|
||||
_instanceId(instanceId)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1),
|
||||
@ -192,10 +169,10 @@ TransmitMixer::~TransmitMixer()
|
||||
{
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1),
|
||||
"TransmitMixer::~TransmitMixer() - dtor");
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
if (_processThreadPtr)
|
||||
{
|
||||
_processThreadPtr->DeRegisterModule(&_monitorModule);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
rtc::CritScope cs(&_critSect);
|
||||
if (file_recorder_) {
|
||||
@ -225,8 +202,9 @@ TransmitMixer::SetEngineInformation(ProcessThread& processThread,
|
||||
_engineStatisticsPtr = &engineStatistics;
|
||||
_channelManagerPtr = &channelManager;
|
||||
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
_processThreadPtr->RegisterModule(&_monitorModule);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1077,10 +1055,6 @@ void TransmitMixer::ProcessAudio(int delay_ms, int clock_drift,
|
||||
|
||||
// Store new capture level. Only updated when analog AGC is enabled.
|
||||
_captureLevel = agc->stream_analog_level();
|
||||
|
||||
rtc::CritScope cs(&_critSect);
|
||||
// Triggers a callback in OnPeriodicProcess().
|
||||
_saturationWarning |= agc->stream_is_saturated();
|
||||
}
|
||||
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
|
||||
@ -132,8 +132,10 @@ public:
|
||||
|
||||
virtual ~TransmitMixer();
|
||||
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
// Periodic callback from the MonitorModule.
|
||||
void OnPeriodicProcess();
|
||||
#endif
|
||||
|
||||
// FileCallback
|
||||
void PlayNotification(const int32_t id,
|
||||
@ -161,7 +163,11 @@ public:
|
||||
bool IsStereoChannelSwappingEnabled();
|
||||
|
||||
protected:
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
TransmitMixer() : _monitorModule(this) {}
|
||||
#else
|
||||
TransmitMixer() = default;
|
||||
#endif
|
||||
|
||||
private:
|
||||
TransmitMixer(uint32_t instanceId);
|
||||
@ -194,7 +200,6 @@ private:
|
||||
ProcessThread* _processThreadPtr = nullptr;
|
||||
|
||||
// owns
|
||||
MonitorModule<TransmitMixer> _monitorModule;
|
||||
AudioFrame _audioFrame;
|
||||
PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate
|
||||
std::unique_ptr<FilePlayer> file_player_;
|
||||
@ -212,11 +217,11 @@ private:
|
||||
rtc::CriticalSection _callbackCritSect;
|
||||
|
||||
#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
||||
MonitorModule<TransmitMixer> _monitorModule;
|
||||
webrtc::TypingDetection _typingDetection;
|
||||
bool _typingNoiseWarningPending = false;
|
||||
bool _typingNoiseDetected = false;
|
||||
#endif
|
||||
bool _saturationWarning = false;
|
||||
|
||||
int _instanceId = 0;
|
||||
bool _mixFileWithMicrophone = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user