Some minor changes to the native code
This commit is contained in:
parent
a57246bb8b
commit
4105711040
native
serverconnection
updater
3
native/serverconnection/exports/exports.d.ts
vendored
3
native/serverconnection/exports/exports.d.ts
vendored
@ -296,7 +296,8 @@ export namespace audio {
|
||||
|
||||
"residual_echo_detector.enabled": boolean,
|
||||
"level_estimation.enabled": boolean,
|
||||
"rnnoise.enabled": boolean
|
||||
"rnnoise.enabled": boolean,
|
||||
"artificial_stream_delay": number
|
||||
}
|
||||
|
||||
export interface AudioProcessorStatistics {
|
||||
|
@ -177,6 +177,7 @@ NAN_METHOD(AudioProcessorWrapper::get_config) {
|
||||
PUT_CONFIG(residual_echo_detector.enabled);
|
||||
PUT_CONFIG(level_estimation.enabled);
|
||||
PUT_CONFIG(rnnoise.enabled);
|
||||
PUT_CONFIG(artificial_stream_delay);
|
||||
|
||||
info.GetReturnValue().Set(result);
|
||||
}
|
||||
@ -351,6 +352,7 @@ NAN_METHOD(AudioProcessorWrapper::apply_config) {
|
||||
LOAD_CONFIG(residual_echo_detector.enabled);
|
||||
LOAD_CONFIG(level_estimation.enabled);
|
||||
LOAD_CONFIG(rnnoise.enabled);
|
||||
LOAD_CONFIG(artificial_stream_delay);
|
||||
|
||||
processor->apply_config(config);
|
||||
}
|
||||
|
@ -118,6 +118,11 @@ void AudioProcessor::apply_config(const AudioProcessor::Config &config) {
|
||||
|
||||
void AudioProcessor::apply_config_unlocked(const Config &config) {
|
||||
this->current_config = config;
|
||||
|
||||
/* These are internal bounds and should not be changed */
|
||||
this->current_config.gain_controller1.analog_level_minimum = 0;
|
||||
this->current_config.gain_controller1.analog_level_maximum = 255;
|
||||
|
||||
if(this->processor) {
|
||||
this->processor->ApplyConfig(config);
|
||||
}
|
||||
@ -125,7 +130,7 @@ void AudioProcessor::apply_config_unlocked(const Config &config) {
|
||||
if(!this->current_config.rnnoise.enabled) {
|
||||
this->rnnoise_volume = absl::nullopt;
|
||||
}
|
||||
log_trace(category::audio, tr("Applying process config:\n{}\nRNNoise: "), config.ToString(), this->current_config.rnnoise.enabled);
|
||||
log_trace(category::audio, tr("Applying process config:\n{}\nRNNoise: {}\nArtificial stream delay: {}"), config.ToString(), this->current_config.rnnoise.enabled, this->current_config.artificial_stream_delay);
|
||||
}
|
||||
|
||||
AudioProcessor::Stats AudioProcessor::get_statistics() const {
|
||||
@ -217,8 +222,12 @@ std::optional<AudioProcessor::Stats> AudioProcessor::process_stream(const webrtc
|
||||
}
|
||||
}
|
||||
|
||||
this->processor->set_stream_delay_ms(2); /* TODO: Measure it and not just guess it! */
|
||||
this->processor->set_stream_analog_level(0);
|
||||
/* TODO: Measure it and not just guess it! */
|
||||
this->processor->set_stream_delay_ms(this->current_config.artificial_stream_delay);
|
||||
if(this->current_config.gain_controller1.enabled) {
|
||||
/* TODO: Calculate the actual audio volume */
|
||||
this->processor->set_stream_analog_level(0);
|
||||
}
|
||||
|
||||
auto result = this->processor->ProcessStream(buffer, config, config, buffer);
|
||||
if(result != webrtc::AudioProcessing::kNoError) {
|
||||
|
@ -12,6 +12,8 @@ namespace tc::audio {
|
||||
struct {
|
||||
bool enabled{false};
|
||||
} rnnoise;
|
||||
|
||||
int artificial_stream_delay{0};
|
||||
};
|
||||
|
||||
struct Stats : public webrtc::AudioProcessingStats {
|
||||
|
@ -51,6 +51,8 @@ using namespace std;
|
||||
|
||||
bool is_executable(const std::string& file) {
|
||||
chmod(file.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
/* We chmod above but for some reasons access still fails. This should be fixed but I want to finish the linux client... */
|
||||
return true;
|
||||
return access(file.c_str(), F_OK | X_OK) == 0;
|
||||
}
|
||||
|
||||
@ -89,7 +91,6 @@ inline std::string build_callback_info(const std::string& error_id, const std::s
|
||||
void execute_callback_fail_exit(const std::string& error, const std::string& error_message) {
|
||||
file::rollback();
|
||||
|
||||
//int chmod(const char *path, mode_t mode);
|
||||
if(!is_executable(config::callback_file)) {
|
||||
logger::fatal("callback file (%s) is not executable! Ignoring fail callback", config::callback_file.c_str());
|
||||
logger::flush();
|
||||
|
Loading…
Reference in New Issue
Block a user