iSAC config: target bitrate exposed for fixed impl

It is now possible to set the target bitrate for iSAC for the fixed
point implementation. Unit tests added.

Bug: webrtc:11360
Change-Id: I60225d4ca1363cdacf18931e7cf412c5aec8d8fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168529
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30526}
This commit is contained in:
Alessio Bazzica
2020-02-14 14:34:56 +01:00
committed by Commit Bot
parent 2517a47b01
commit 08b11cafae
3 changed files with 230 additions and 59 deletions

View File

@ -56,6 +56,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
RTC_DCHECK(config.IsOk());
AudioEncoderIsacFixImpl::Config c;
c.frame_size_ms = config.frame_size_ms;
c.bit_rate = config.bit_rate;
c.payload_type = payload_type;
return std::make_unique<AudioEncoderIsacFixImpl>(c);
}

View File

@ -26,8 +26,17 @@ namespace webrtc {
// parameter to CreateAudioEncoderFactory<...>().
struct RTC_EXPORT AudioEncoderIsacFix {
struct Config {
bool IsOk() const { return frame_size_ms == 30 || frame_size_ms == 60; }
bool IsOk() const {
if (frame_size_ms != 30 && frame_size_ms != 60) {
return false;
}
if (bit_rate < 10000 || bit_rate > 32000) {
return false;
}
return true;
}
int frame_size_ms = 30;
int bit_rate = 32000; // Limit on short-term average bit rate, in bits/s.
};
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);