Skip to content

Commit

Permalink
red: pass through calls to underlying encoder
Browse files Browse the repository at this point in the history
BUG=webrtc:11640

Change-Id: I87e6f7c91c80d61e64127574485bbdcaedc8120c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181063
Reviewed-by: Minyue Li <[email protected]>
Commit-Queue: Philipp Hancke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#33595}
  • Loading branch information
fippo authored and Commit Bot committed Mar 30, 2021
1 parent eca8551 commit 883fea1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
39 changes: 36 additions & 3 deletions modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ bool AudioEncoderCopyRed::SetDtx(bool enable) {
return speech_encoder_->SetDtx(enable);
}

bool AudioEncoderCopyRed::GetDtx() const {
return speech_encoder_->GetDtx();
}

bool AudioEncoderCopyRed::SetApplication(Application application) {
return speech_encoder_->SetApplication(application);
}
Expand All @@ -190,9 +194,14 @@ void AudioEncoderCopyRed::SetMaxPlaybackRate(int frequency_hz) {
speech_encoder_->SetMaxPlaybackRate(frequency_hz);
}

rtc::ArrayView<std::unique_ptr<AudioEncoder>>
AudioEncoderCopyRed::ReclaimContainedEncoders() {
return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1);
bool AudioEncoderCopyRed::EnableAudioNetworkAdaptor(
const std::string& config_string,
RtcEventLog* event_log) {
return speech_encoder_->EnableAudioNetworkAdaptor(config_string, event_log);
}

void AudioEncoderCopyRed::DisableAudioNetworkAdaptor() {
speech_encoder_->DisableAudioNetworkAdaptor();
}

void AudioEncoderCopyRed::OnReceivedUplinkPacketLossFraction(
Expand All @@ -208,14 +217,38 @@ void AudioEncoderCopyRed::OnReceivedUplinkBandwidth(
bwe_period_ms);
}

void AudioEncoderCopyRed::OnReceivedUplinkAllocation(
BitrateAllocationUpdate update) {
speech_encoder_->OnReceivedUplinkAllocation(update);
}

absl::optional<std::pair<TimeDelta, TimeDelta>>
AudioEncoderCopyRed::GetFrameLengthRange() const {
return speech_encoder_->GetFrameLengthRange();
}

void AudioEncoderCopyRed::OnReceivedRtt(int rtt_ms) {
speech_encoder_->OnReceivedRtt(rtt_ms);
}

void AudioEncoderCopyRed::OnReceivedOverhead(size_t overhead_bytes_per_packet) {
max_packet_length_ = kAudioMaxRtpPacketLen - 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
16 changes: 14 additions & 2 deletions modules/audio_coding/codecs/red/audio_encoder_copy_red.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,33 @@ class AudioEncoderCopyRed final : public AudioEncoder {
size_t Num10MsFramesInNextPacket() const override;
size_t Max10MsFramesInAPacket() const override;
int GetTargetBitrate() const override;

void Reset() override;
bool SetFec(bool enable) override;

bool SetDtx(bool enable) override;
bool GetDtx() const override;

bool SetApplication(Application application) override;
void SetMaxPlaybackRate(int frequency_hz) override;
rtc::ArrayView<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders()
override;
bool EnableAudioNetworkAdaptor(const std::string& config_string,
RtcEventLog* event_log) override;
void DisableAudioNetworkAdaptor() override;
void OnReceivedUplinkPacketLossFraction(
float uplink_packet_loss_fraction) override;
void OnReceivedUplinkBandwidth(
int target_audio_bitrate_bps,
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 SetReceiverFrameLengthRange(int min_frame_length_ms,
int max_frame_length_ms) override;
ANAStats GetANAStats() const override;
absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
const override;
rtc::ArrayView<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders()
override;

protected:
EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
Expand Down

0 comments on commit 883fea1

Please sign in to comment.