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:
@ -11,10 +11,13 @@
|
||||
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_
|
||||
#define MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -49,6 +52,8 @@ class AudioEncoderIsacT final : public AudioEncoder {
|
||||
rtc::ArrayView<const int16_t> audio,
|
||||
rtc::Buffer* encoded) override;
|
||||
void Reset() override;
|
||||
absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
|
||||
const override;
|
||||
|
||||
private:
|
||||
// This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and
|
||||
|
||||
@ -119,6 +119,13 @@ void AudioEncoderIsacT<T>::Reset() {
|
||||
RecreateEncoderInstance(config_);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
absl::optional<std::pair<TimeDelta, TimeDelta>>
|
||||
AudioEncoderIsacT<T>::GetFrameLengthRange() const {
|
||||
return {{TimeDelta::Millis(config_.frame_size_ms),
|
||||
TimeDelta::Millis(config_.frame_size_ms)}};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) {
|
||||
RTC_CHECK(config.IsOk());
|
||||
|
||||
Reference in New Issue
Block a user