Use ordered data structure for supported frame lengths in ANA.
The ANA frame length controller requires the provided frame lengths supported by the encoder to be ordered. A data structural guarantee of such was in an earlier version but was accidentally removed since https://codereview.webrtc.org/2429503002. This CL uses std::set to ensure that again. Change-Id: Ia197dbf6a34f02506e81c9f49d6cd60e4cdacef4 BUG: webrtc:6303 Reviewed-on: https://webrtc-review.googlesource.com/c/115946 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Commit-Queue: Minyue Li <minyue@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26119}
This commit is contained in:
@ -147,13 +147,13 @@ std::unique_ptr<FrameLengthController> CreateFrameLengthController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
FrameLengthController::Config ctor_config(
|
FrameLengthController::Config ctor_config(
|
||||||
std::vector<int>(), initial_frame_length_ms, min_encoder_bitrate_bps,
|
std::set<int>(), initial_frame_length_ms, min_encoder_bitrate_bps,
|
||||||
config.fl_increasing_packet_loss_fraction(),
|
config.fl_increasing_packet_loss_fraction(),
|
||||||
config.fl_decreasing_packet_loss_fraction(), fl_increase_overhead_offset,
|
config.fl_decreasing_packet_loss_fraction(), fl_increase_overhead_offset,
|
||||||
fl_decrease_overhead_offset, std::move(fl_changing_bandwidths_bps));
|
fl_decrease_overhead_offset, std::move(fl_changing_bandwidths_bps));
|
||||||
|
|
||||||
for (auto frame_length : encoder_frame_lengths_ms)
|
for (auto frame_length : encoder_frame_lengths_ms)
|
||||||
ctor_config.encoder_frame_lengths_ms.push_back(frame_length);
|
ctor_config.encoder_frame_lengths_ms.insert(frame_length);
|
||||||
|
|
||||||
return std::unique_ptr<FrameLengthController>(
|
return std::unique_ptr<FrameLengthController>(
|
||||||
new FrameLengthController(ctor_config));
|
new FrameLengthController(ctor_config));
|
||||||
|
@ -28,7 +28,7 @@ int OverheadRateBps(size_t overhead_bytes_per_packet, int frame_length_ms) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
FrameLengthController::Config::Config(
|
FrameLengthController::Config::Config(
|
||||||
const std::vector<int>& encoder_frame_lengths_ms,
|
const std::set<int>& encoder_frame_lengths_ms,
|
||||||
int initial_frame_length_ms,
|
int initial_frame_length_ms,
|
||||||
int min_encoder_bitrate_bps,
|
int min_encoder_bitrate_bps,
|
||||||
float fl_increasing_packet_loss_fraction,
|
float fl_increasing_packet_loss_fraction,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <set>
|
||||||
|
|
||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "modules/audio_coding/audio_network_adaptor/controller.h"
|
#include "modules/audio_coding/audio_network_adaptor/controller.h"
|
||||||
@ -33,7 +33,7 @@ class FrameLengthController final : public Controller {
|
|||||||
int from_frame_length_ms;
|
int from_frame_length_ms;
|
||||||
int to_frame_length_ms;
|
int to_frame_length_ms;
|
||||||
};
|
};
|
||||||
Config(const std::vector<int>& encoder_frame_lengths_ms,
|
Config(const std::set<int>& encoder_frame_lengths_ms,
|
||||||
int initial_frame_length_ms,
|
int initial_frame_length_ms,
|
||||||
int min_encoder_bitrate_bps,
|
int min_encoder_bitrate_bps,
|
||||||
float fl_increasing_packet_loss_fraction,
|
float fl_increasing_packet_loss_fraction,
|
||||||
@ -43,7 +43,7 @@ class FrameLengthController final : public Controller {
|
|||||||
std::map<FrameLengthChange, int> fl_changing_bandwidths_bps);
|
std::map<FrameLengthChange, int> fl_changing_bandwidths_bps);
|
||||||
Config(const Config& other);
|
Config(const Config& other);
|
||||||
~Config();
|
~Config();
|
||||||
std::vector<int> encoder_frame_lengths_ms;
|
std::set<int> encoder_frame_lengths_ms;
|
||||||
int initial_frame_length_ms;
|
int initial_frame_length_ms;
|
||||||
int min_encoder_bitrate_bps;
|
int min_encoder_bitrate_bps;
|
||||||
// Uplink packet loss fraction below which frame length can increase.
|
// Uplink packet loss fraction below which frame length can increase.
|
||||||
@ -74,7 +74,7 @@ class FrameLengthController final : public Controller {
|
|||||||
|
|
||||||
const Config config_;
|
const Config config_;
|
||||||
|
|
||||||
std::vector<int>::const_iterator frame_length_ms_;
|
std::set<int>::const_iterator frame_length_ms_;
|
||||||
|
|
||||||
absl::optional<int> uplink_bandwidth_bps_;
|
absl::optional<int> uplink_bandwidth_bps_;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ int VeryLowBitrate(int frame_length_ms) {
|
|||||||
std::unique_ptr<FrameLengthController> CreateController(
|
std::unique_ptr<FrameLengthController> CreateController(
|
||||||
const std::map<FrameLengthController::Config::FrameLengthChange, int>&
|
const std::map<FrameLengthController::Config::FrameLengthChange, int>&
|
||||||
frame_length_change_criteria,
|
frame_length_change_criteria,
|
||||||
const std::vector<int>& encoder_frame_lengths_ms,
|
const std::set<int>& encoder_frame_lengths_ms,
|
||||||
int initial_frame_length_ms) {
|
int initial_frame_length_ms) {
|
||||||
std::unique_ptr<FrameLengthController> controller(
|
std::unique_ptr<FrameLengthController> controller(
|
||||||
new FrameLengthController(FrameLengthController::Config(
|
new FrameLengthController(FrameLengthController::Config(
|
||||||
|
Reference in New Issue
Block a user