#include "modules/audio_coding/neteq/decision_logic.h"
#include <stdio.h>
#include <cstdint>
#include <memory>
#include "absl/types/optional.h"
#include "api/neteq/neteq.h"
#include "api/neteq/neteq_controller.h"
#include "modules/audio_coding/neteq/packet_arrival_history.h"
#include "modules/audio_coding/neteq/packet_buffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
namespace webrtc {
namespace {
constexpr int kPostponeDecodingLevel = …;
constexpr int kTargetLevelWindowMs = …;
constexpr int kDelayAdjustmentGranularityMs = …;
constexpr int kPacketHistorySizeMs = …;
constexpr size_t kCngTimeoutMs = …;
std::unique_ptr<DelayManager> CreateDelayManager(
const Environment& env,
const NetEqController::Config& neteq_config) { … }
bool IsTimestretch(NetEq::Mode mode) { … }
bool IsCng(NetEq::Mode mode) { … }
bool IsExpand(NetEq::Mode mode) { … }
}
DecisionLogic::DecisionLogic(const Environment& env,
NetEqController::Config config)
: … { … }
DecisionLogic::DecisionLogic(
NetEqController::Config config,
std::unique_ptr<DelayManager> delay_manager,
std::unique_ptr<BufferLevelFilter> buffer_level_filter,
std::unique_ptr<PacketArrivalHistory> packet_arrival_history)
: … { … }
DecisionLogic::~DecisionLogic() = default;
void DecisionLogic::SoftReset() { … }
void DecisionLogic::SetSampleRate(int fs_hz, size_t output_size_samples) { … }
NetEq::Operation DecisionLogic::GetDecision(const NetEqStatus& status,
bool* reset_decoder) { … }
int DecisionLogic::TargetLevelMs() const { … }
int DecisionLogic::UnlimitedTargetLevelMs() const { … }
int DecisionLogic::GetFilteredBufferLevel() const { … }
absl::optional<int> DecisionLogic::PacketArrived(
int fs_hz,
bool should_update_stats,
const PacketArrivedInfo& info) { … }
void DecisionLogic::FilterBufferLevel(size_t buffer_size_samples) { … }
NetEq::Operation DecisionLogic::CngOperation(
NetEqController::NetEqStatus status) { … }
NetEq::Operation DecisionLogic::NoPacket(NetEqController::NetEqStatus status) { … }
NetEq::Operation DecisionLogic::ExpectedPacketAvailable(
NetEqController::NetEqStatus status) { … }
NetEq::Operation DecisionLogic::FuturePacketAvailable(
NetEqController::NetEqStatus status) { … }
bool DecisionLogic::UnderTargetLevel() const { … }
bool DecisionLogic::PostponeDecode(NetEqController::NetEqStatus status) const { … }
bool DecisionLogic::PacketTooEarly(NetEqController::NetEqStatus status) const { … }
int DecisionLogic::GetPlayoutDelayMs(
NetEqController::NetEqStatus status) const { … }
}