Implement AudioEncoder::GetFrameLengthRange() for all audio encoders.

The WebRTC-SendSideBwe-WithOverhead field trial requires audio
encoders to properly implement the
AudioEncoder::GetFrameLengthRange() function. Thic CL implements
the function for all audio encoders in WebRTC in preparation for
making that function pure virtual in the interface.


Bug: webrtc:11427
Change-Id: Ieab6b6c72c62af6ac9525a20fcb39bd477079551
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171503
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30890}
This commit is contained in:
Ali Tofigh
2020-03-24 16:00:51 +01:00
committed by Commit Bot
parent d4262dffa0
commit 7e5dfdbca3
16 changed files with 108 additions and 0 deletions

View File

@ -164,6 +164,12 @@ void AudioEncoderMultiChannelOpusImpl::Reset() {
RTC_CHECK(RecreateEncoderInstance(config_));
}
absl::optional<std::pair<TimeDelta, TimeDelta>>
AudioEncoderMultiChannelOpusImpl::GetFrameLengthRange() const {
return {{TimeDelta::Millis(config_.frame_size_ms),
TimeDelta::Millis(config_.frame_size_ms)}};
}
// If the given config is OK, recreate the Opus encoder instance with those
// settings, save the config, and return true. Otherwise, do nothing and return
// false.

View File

@ -12,12 +12,14 @@
#define MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_IMPL_H_
#include <memory>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h"
#include "api/units/time_delta.h"
#include "modules/audio_coding/codecs/opus/opus_interface.h"
#include "rtc_base/constructor_magic.h"
@ -44,6 +46,8 @@ class AudioEncoderMultiChannelOpusImpl final : public AudioEncoder {
int GetTargetBitrate() const override;
void Reset() override;
absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
const override;
protected:
EncodedInfo EncodeImpl(uint32_t rtp_timestamp,