Disallow buffer level filtering for DTX packets.
We knew that we should not update buffer level during DTX period. We already fulfill this upon no packet receipt. But we missed doing it for DTX-signaling packets. This CL is to fix that. Bug: b/129521878 Change-Id: I72ca18e3b21e956123fe6e3119ef0d7c981c9eec Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133183 Commit-Queue: Minyue Li <minyue@webrtc.org> Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27643}
This commit is contained in:
parent
494947bbcf
commit
7d204d5ce9
@ -126,7 +126,13 @@ Operations DecisionLogic::GetDecision(const SyncBuffer& sync_buffer,
|
||||
prev_mode == kModePreemptiveExpandSuccess ||
|
||||
prev_mode == kModePreemptiveExpandLowEnergy);
|
||||
|
||||
FilterBufferLevel(cur_size_samples, prev_mode);
|
||||
// Do not update buffer history if currently playing CNG since it will bias
|
||||
// the filtered buffer level.
|
||||
if ((prev_mode != kModeRfc3389Cng) && (prev_mode != kModeCodecInternalCng) &&
|
||||
!(next_packet && next_packet->frame &&
|
||||
next_packet->frame->IsDtxPacket())) {
|
||||
FilterBufferLevel(cur_size_samples);
|
||||
}
|
||||
|
||||
// Guard for errors, to avoid getting stuck in error mode.
|
||||
if (prev_mode == kModeError) {
|
||||
@ -206,29 +212,24 @@ void DecisionLogic::ExpandDecision(Operations operation) {
|
||||
}
|
||||
}
|
||||
|
||||
void DecisionLogic::FilterBufferLevel(size_t buffer_size_samples,
|
||||
Modes prev_mode) {
|
||||
// Do not update buffer history if currently playing CNG since it will bias
|
||||
// the filtered buffer level.
|
||||
if ((prev_mode != kModeRfc3389Cng) && (prev_mode != kModeCodecInternalCng)) {
|
||||
buffer_level_filter_->SetTargetBufferLevel(
|
||||
delay_manager_->base_target_level());
|
||||
void DecisionLogic::FilterBufferLevel(size_t buffer_size_samples) {
|
||||
buffer_level_filter_->SetTargetBufferLevel(
|
||||
delay_manager_->base_target_level());
|
||||
|
||||
size_t buffer_size_packets = 0;
|
||||
if (packet_length_samples_ > 0) {
|
||||
// Calculate size in packets.
|
||||
buffer_size_packets = buffer_size_samples / packet_length_samples_;
|
||||
}
|
||||
int sample_memory_local = 0;
|
||||
if (prev_time_scale_) {
|
||||
sample_memory_local = sample_memory_;
|
||||
timescale_countdown_ =
|
||||
tick_timer_->GetNewCountdown(kMinTimescaleInterval);
|
||||
}
|
||||
buffer_level_filter_->Update(buffer_size_packets, sample_memory_local,
|
||||
packet_length_samples_);
|
||||
prev_time_scale_ = false;
|
||||
size_t buffer_size_packets = 0;
|
||||
if (packet_length_samples_ > 0) {
|
||||
// Calculate size in packets.
|
||||
buffer_size_packets = buffer_size_samples / packet_length_samples_;
|
||||
}
|
||||
int sample_memory_local = 0;
|
||||
if (prev_time_scale_) {
|
||||
sample_memory_local = sample_memory_;
|
||||
timescale_countdown_ = tick_timer_->GetNewCountdown(kMinTimescaleInterval);
|
||||
}
|
||||
|
||||
buffer_level_filter_->Update(buffer_size_packets, sample_memory_local,
|
||||
packet_length_samples_);
|
||||
prev_time_scale_ = false;
|
||||
}
|
||||
|
||||
Operations DecisionLogic::CngOperation(Modes prev_mode,
|
||||
|
||||
@ -116,7 +116,7 @@ class DecisionLogic final {
|
||||
|
||||
// Updates the |buffer_level_filter_| with the current buffer level
|
||||
// |buffer_size_packets|.
|
||||
void FilterBufferLevel(size_t buffer_size_packets, Modes prev_mode);
|
||||
void FilterBufferLevel(size_t buffer_size_packets);
|
||||
|
||||
// Returns the operation given that the next available packet is a comfort
|
||||
// noise payload (RFC 3389 only, not codec-internal).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user