chromium/remoting/client/audio/audio_jitter_buffer.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "remoting/client/audio/audio_jitter_buffer.h"

#include <algorithm>
#include <string>

#include "base/check_op.h"

namespace {

// AudioJitterBuffer maintains a list of AudioPackets whose total playback
// duration <= |kMaxQueueLatency|.
// Once the buffer has run out of AudioPackets (latency reaches 0), it waits
// until the total latency reaches |kUnderrunRecoveryLatency| before it starts
// feeding the get-data requests. This helps reduce the frequency of stopping
// when the buffer underruns.
// If the total latency has reached |kMaxQueueLatency|, the oldest packets
// will get dropped until the latency is reduced to no more than
// |kOverrunRecoveryLatency|. This helps reduce the number of glitches when
// the buffer overruns.
// Otherwise the total latency can freely fluctuate between 0 and
// |kMaxQueueLatency|.

constexpr base::TimeDelta kMaxQueueLatency =;
constexpr base::TimeDelta kUnderrunRecoveryLatency =;
constexpr base::TimeDelta kOverrunRecoveryLatency =;

}  // namespace

namespace remoting {

AudioJitterBuffer::AudioJitterBuffer(
    OnFormatChangedCallback on_format_changed) {}

AudioJitterBuffer::~AudioJitterBuffer() = default;

void AudioJitterBuffer::AddAudioPacket(std::unique_ptr<AudioPacket> packet) {}

void AudioJitterBuffer::AsyncGetData(std::unique_ptr<GetDataRequest> request) {}

void AudioJitterBuffer::ClearGetDataRequests() {}

void AudioJitterBuffer::ResetBuffer(const AudioStreamFormat& new_format) {}

void AudioJitterBuffer::ProcessGetDataRequests() {}

size_t AudioJitterBuffer::GetBufferSizeFromTime(
    base::TimeDelta duration) const {}

void AudioJitterBuffer::DropOverrunPackets() {}

}  // namespace remoting