webrtc自動增益

前提

本文代碼基於webrtc M59

背景

有些android設備上語音響度不夠需要使用自動增益功能增強響度。

主要有兩個方面:

(1)發送端的自動增益

(2)接收端的自動增益,該版本這個功能已經移除( Removing the RX processing APIs from VoEAudioProcessing),不做討論

webrtc已經提供選項設置自動增益開關,開關如下:

audioConstraints.mandatory.add(
              new MediaConstraints.KeyValuePair(“googAutoGainControl”, "true"));

但是增益值沒有提供選項到java層需要自己封裝,代碼如下:

mediaconstraintsinterface.h
static const char kAutoGainControlLevel[]; //目標電平的值

mediaconstraintsinterface.cc
const char MediaConstraintsInterface::kAutoGainControlLevel[] = "googAutoGainControlLevel"; //提供給java層的選項名

CopyConstraintsIntoAudioOptions接口賦值

//set auto gain level                           
  ConstraintToOptional<uint16_t>(constraints,
                             MediaConstraintsInterface::kAutoGainControlLevel,
                             &options->tx_agc_target_dbov);

java層設置值:
audioConstraints.mandatory.add(
              new MediaConstraints.KeyValuePair(“googAutoGainControlLevel”, "3"));

備註:

以下是一些參數配置和初始化過程的接口

WebRtcAgc_set_config
GainControlImpl::Configure
GainControlImpl::Enable -》GainControlImpl::Initialize-》gain_controller->Initialize
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章