Hard code rtx handling option in NetEq.
This allows NetEq to adapt to late reordered packets which are common when using retransmissions. Remaining cleanup of the plumbing from WebRTC API will be done in a follow-up cl. Bug: webrtc:10178 Change-Id: Ia9911eaafdabd3b69441dc089116d79e24f1b2b2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231002 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#34898}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
2c41cbae37
commit
7cca016721
@ -59,14 +59,12 @@ std::unique_ptr<NetEqController> CreateNetEqController(
|
|||||||
const NetEqControllerFactory& controller_factory,
|
const NetEqControllerFactory& controller_factory,
|
||||||
int base_min_delay,
|
int base_min_delay,
|
||||||
int max_packets_in_buffer,
|
int max_packets_in_buffer,
|
||||||
bool enable_rtx_handling,
|
|
||||||
bool allow_time_stretching,
|
bool allow_time_stretching,
|
||||||
TickTimer* tick_timer,
|
TickTimer* tick_timer,
|
||||||
webrtc::Clock* clock) {
|
webrtc::Clock* clock) {
|
||||||
NetEqController::Config config;
|
NetEqController::Config config;
|
||||||
config.base_min_delay_ms = base_min_delay;
|
config.base_min_delay_ms = base_min_delay;
|
||||||
config.max_packets_in_buffer = max_packets_in_buffer;
|
config.max_packets_in_buffer = max_packets_in_buffer;
|
||||||
config.enable_rtx_handling = enable_rtx_handling;
|
|
||||||
config.allow_time_stretching = allow_time_stretching;
|
config.allow_time_stretching = allow_time_stretching;
|
||||||
config.tick_timer = tick_timer;
|
config.tick_timer = tick_timer;
|
||||||
config.clock = clock;
|
config.clock = clock;
|
||||||
@ -111,7 +109,6 @@ NetEqImpl::Dependencies::Dependencies(
|
|||||||
CreateNetEqController(controller_factory,
|
CreateNetEqController(controller_factory,
|
||||||
config.min_delay_ms,
|
config.min_delay_ms,
|
||||||
config.max_packets_in_buffer,
|
config.max_packets_in_buffer,
|
||||||
config.enable_rtx_handling,
|
|
||||||
!config.for_test_no_time_stretching,
|
!config.for_test_no_time_stretching,
|
||||||
tick_timer.get(),
|
tick_timer.get(),
|
||||||
clock)),
|
clock)),
|
||||||
@ -158,7 +155,6 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config,
|
|||||||
10, // Report once every 10 s.
|
10, // Report once every 10 s.
|
||||||
tick_timer_.get()),
|
tick_timer_.get()),
|
||||||
no_time_stretching_(config.for_test_no_time_stretching),
|
no_time_stretching_(config.for_test_no_time_stretching),
|
||||||
enable_rtx_handling_(config.enable_rtx_handling),
|
|
||||||
output_delay_chain_ms_(
|
output_delay_chain_ms_(
|
||||||
GetDelayChainLengthMs(config.extra_output_delay_ms)),
|
GetDelayChainLengthMs(config.extra_output_delay_ms)),
|
||||||
output_delay_chain_(rtc::CheckedDivExact(output_delay_chain_ms_, 10)) {
|
output_delay_chain_(rtc::CheckedDivExact(output_delay_chain_ms_, 10)) {
|
||||||
@ -825,14 +821,8 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
|
|||||||
info.main_sequence_number = main_sequence_number;
|
info.main_sequence_number = main_sequence_number;
|
||||||
info.is_dtx = is_dtx;
|
info.is_dtx = is_dtx;
|
||||||
info.buffer_flush = buffer_flush_occured;
|
info.buffer_flush = buffer_flush_occured;
|
||||||
// Only update statistics if incoming packet is not older than last played
|
|
||||||
// out packet or RTX handling is enabled, and if new codec flag is not
|
|
||||||
// set.
|
|
||||||
const bool should_update_stats =
|
|
||||||
(enable_rtx_handling_ ||
|
|
||||||
static_cast<int32_t>(main_timestamp - timestamp_) >= 0) &&
|
|
||||||
!new_codec_;
|
|
||||||
|
|
||||||
|
const bool should_update_stats = !new_codec_;
|
||||||
auto relative_delay =
|
auto relative_delay =
|
||||||
controller_->PacketArrived(fs_hz_, should_update_stats, info);
|
controller_->PacketArrived(fs_hz_, should_update_stats, info);
|
||||||
if (relative_delay) {
|
if (relative_delay) {
|
||||||
|
@ -399,7 +399,6 @@ class NetEqImpl : public webrtc::NetEq {
|
|||||||
ExpandUmaLogger speech_expand_uma_logger_ RTC_GUARDED_BY(mutex_);
|
ExpandUmaLogger speech_expand_uma_logger_ RTC_GUARDED_BY(mutex_);
|
||||||
bool no_time_stretching_ RTC_GUARDED_BY(mutex_); // Only used for test.
|
bool no_time_stretching_ RTC_GUARDED_BY(mutex_); // Only used for test.
|
||||||
rtc::BufferT<int16_t> concealment_audio_ RTC_GUARDED_BY(mutex_);
|
rtc::BufferT<int16_t> concealment_audio_ RTC_GUARDED_BY(mutex_);
|
||||||
const bool enable_rtx_handling_ RTC_GUARDED_BY(mutex_);
|
|
||||||
// Data members used for adding extra delay to the output of NetEq.
|
// Data members used for adding extra delay to the output of NetEq.
|
||||||
// The delay in ms (which is 10 times the number of elements in
|
// The delay in ms (which is 10 times the number of elements in
|
||||||
// output_delay_chain_).
|
// output_delay_chain_).
|
||||||
|
@ -122,7 +122,6 @@ class NetEqImplTest : public ::testing::Test {
|
|||||||
NetEqController::Config controller_config;
|
NetEqController::Config controller_config;
|
||||||
controller_config.tick_timer = tick_timer_;
|
controller_config.tick_timer = tick_timer_;
|
||||||
controller_config.base_min_delay_ms = config_.min_delay_ms;
|
controller_config.base_min_delay_ms = config_.min_delay_ms;
|
||||||
controller_config.enable_rtx_handling = config_.enable_rtx_handling;
|
|
||||||
controller_config.allow_time_stretching = true;
|
controller_config.allow_time_stretching = true;
|
||||||
controller_config.max_packets_in_buffer = config_.max_packets_in_buffer;
|
controller_config.max_packets_in_buffer = config_.max_packets_in_buffer;
|
||||||
controller_config.clock = &clock_;
|
controller_config.clock = &clock_;
|
||||||
@ -1603,12 +1602,11 @@ TEST_F(NetEqImplTest, InsertEmptyPacket) {
|
|||||||
neteq_->InsertEmptyPacket(rtp_header);
|
neteq_->InsertEmptyPacket(rtp_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(NetEqImplTest, EnableRtxHandling) {
|
TEST_F(NetEqImplTest, NotifyControllerOfReorderedPacket) {
|
||||||
using ::testing::AllOf;
|
using ::testing::AllOf;
|
||||||
using ::testing::Field;
|
using ::testing::Field;
|
||||||
UseNoMocks();
|
UseNoMocks();
|
||||||
use_mock_neteq_controller_ = true;
|
use_mock_neteq_controller_ = true;
|
||||||
config_.enable_rtx_handling = true;
|
|
||||||
CreateInstance();
|
CreateInstance();
|
||||||
EXPECT_CALL(*mock_neteq_controller_, GetDecision(_, _))
|
EXPECT_CALL(*mock_neteq_controller_, GetDecision(_, _))
|
||||||
.Times(1)
|
.Times(1)
|
||||||
@ -1638,7 +1636,7 @@ TEST_F(NetEqImplTest, EnableRtxHandling) {
|
|||||||
*mock_neteq_controller_,
|
*mock_neteq_controller_,
|
||||||
PacketArrived(
|
PacketArrived(
|
||||||
/*fs_hz*/ 8000,
|
/*fs_hz*/ 8000,
|
||||||
/*should_update_stats*/ _,
|
/*should_update_stats*/ true,
|
||||||
/*info*/
|
/*info*/
|
||||||
AllOf(
|
AllOf(
|
||||||
Field(&NetEqController::PacketArrivedInfo::packet_length_samples,
|
Field(&NetEqController::PacketArrivedInfo::packet_length_samples,
|
||||||
|
Reference in New Issue
Block a user