red: pass through calls to underlying encoder

BUG=webrtc:11640

Change-Id: I87e6f7c91c80d61e64127574485bbdcaedc8120c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181063
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#33595}
This commit is contained in:
Philipp Hancke
2020-08-06 17:30:52 +02:00
committed by Commit Bot
parent eca855197a
commit 883fea1548
2 changed files with 50 additions and 5 deletions

View File

@ -182,6 +182,10 @@ bool AudioEncoderCopyRed::SetDtx(bool enable) {
return speech_encoder_->SetDtx(enable); return speech_encoder_->SetDtx(enable);
} }
bool AudioEncoderCopyRed::GetDtx() const {
return speech_encoder_->GetDtx();
}
bool AudioEncoderCopyRed::SetApplication(Application application) { bool AudioEncoderCopyRed::SetApplication(Application application) {
return speech_encoder_->SetApplication(application); return speech_encoder_->SetApplication(application);
} }
@ -190,9 +194,14 @@ void AudioEncoderCopyRed::SetMaxPlaybackRate(int frequency_hz) {
speech_encoder_->SetMaxPlaybackRate(frequency_hz); speech_encoder_->SetMaxPlaybackRate(frequency_hz);
} }
rtc::ArrayView<std::unique_ptr<AudioEncoder>> bool AudioEncoderCopyRed::EnableAudioNetworkAdaptor(
AudioEncoderCopyRed::ReclaimContainedEncoders() { const std::string& config_string,
return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1); RtcEventLog* event_log) {
return speech_encoder_->EnableAudioNetworkAdaptor(config_string, event_log);
}
void AudioEncoderCopyRed::DisableAudioNetworkAdaptor() {
speech_encoder_->DisableAudioNetworkAdaptor();
} }
void AudioEncoderCopyRed::OnReceivedUplinkPacketLossFraction( void AudioEncoderCopyRed::OnReceivedUplinkPacketLossFraction(
@ -208,14 +217,38 @@ void AudioEncoderCopyRed::OnReceivedUplinkBandwidth(
bwe_period_ms); bwe_period_ms);
} }
void AudioEncoderCopyRed::OnReceivedUplinkAllocation(
BitrateAllocationUpdate update) {
speech_encoder_->OnReceivedUplinkAllocation(update);
}
absl::optional<std::pair<TimeDelta, TimeDelta>> absl::optional<std::pair<TimeDelta, TimeDelta>>
AudioEncoderCopyRed::GetFrameLengthRange() const { AudioEncoderCopyRed::GetFrameLengthRange() const {
return speech_encoder_->GetFrameLengthRange(); return speech_encoder_->GetFrameLengthRange();
} }
void AudioEncoderCopyRed::OnReceivedRtt(int rtt_ms) {
speech_encoder_->OnReceivedRtt(rtt_ms);
}
void AudioEncoderCopyRed::OnReceivedOverhead(size_t overhead_bytes_per_packet) { void AudioEncoderCopyRed::OnReceivedOverhead(size_t overhead_bytes_per_packet) {
max_packet_length_ = kAudioMaxRtpPacketLen - overhead_bytes_per_packet; max_packet_length_ = kAudioMaxRtpPacketLen - overhead_bytes_per_packet;
return speech_encoder_->OnReceivedOverhead(overhead_bytes_per_packet); return speech_encoder_->OnReceivedOverhead(overhead_bytes_per_packet);
} }
void AudioEncoderCopyRed::SetReceiverFrameLengthRange(int min_frame_length_ms,
int max_frame_length_ms) {
return speech_encoder_->SetReceiverFrameLengthRange(min_frame_length_ms,
max_frame_length_ms);
}
ANAStats AudioEncoderCopyRed::GetANAStats() const {
return speech_encoder_->GetANAStats();
}
rtc::ArrayView<std::unique_ptr<AudioEncoder>>
AudioEncoderCopyRed::ReclaimContainedEncoders() {
return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1);
}
} // namespace webrtc } // namespace webrtc

View File

@ -50,21 +50,33 @@ class AudioEncoderCopyRed final : public AudioEncoder {
size_t Num10MsFramesInNextPacket() const override; size_t Num10MsFramesInNextPacket() const override;
size_t Max10MsFramesInAPacket() const override; size_t Max10MsFramesInAPacket() const override;
int GetTargetBitrate() const override; int GetTargetBitrate() const override;
void Reset() override; void Reset() override;
bool SetFec(bool enable) override; bool SetFec(bool enable) override;
bool SetDtx(bool enable) override; bool SetDtx(bool enable) override;
bool GetDtx() const override;
bool SetApplication(Application application) override; bool SetApplication(Application application) override;
void SetMaxPlaybackRate(int frequency_hz) override; void SetMaxPlaybackRate(int frequency_hz) override;
rtc::ArrayView<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders() bool EnableAudioNetworkAdaptor(const std::string& config_string,
override; RtcEventLog* event_log) override;
void DisableAudioNetworkAdaptor() override;
void OnReceivedUplinkPacketLossFraction( void OnReceivedUplinkPacketLossFraction(
float uplink_packet_loss_fraction) override; float uplink_packet_loss_fraction) override;
void OnReceivedUplinkBandwidth( void OnReceivedUplinkBandwidth(
int target_audio_bitrate_bps, int target_audio_bitrate_bps,
absl::optional<int64_t> bwe_period_ms) override; absl::optional<int64_t> bwe_period_ms) override;
void OnReceivedUplinkAllocation(BitrateAllocationUpdate update) override;
void OnReceivedRtt(int rtt_ms) override;
void OnReceivedOverhead(size_t overhead_bytes_per_packet) override; void OnReceivedOverhead(size_t overhead_bytes_per_packet) override;
void SetReceiverFrameLengthRange(int min_frame_length_ms,
int max_frame_length_ms) override;
ANAStats GetANAStats() const override;
absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange() absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
const override; const override;
rtc::ArrayView<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders()
override;
protected: protected:
EncodedInfo EncodeImpl(uint32_t rtp_timestamp, EncodedInfo EncodeImpl(uint32_t rtp_timestamp,