chromium/remoting/client/audio/audio_jitter_buffer_unittest.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 <cstdint>
#include <list>
#include <memory>
#include <string>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "remoting/client/audio/audio_jitter_buffer.h"
#include "remoting/client/audio/audio_stream_format.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace remoting {

namespace {

constexpr AudioPacket::BytesPerSample kBytesPerSample =
    AudioPacket::BYTES_PER_SAMPLE_2;
constexpr AudioPacket::Channels kChannels = AudioPacket::CHANNELS_STEREO;
constexpr uint32_t kAudioSampleBytes =;

constexpr uint32_t kNumConsumerBuffers =;
constexpr uint32_t kConsumerBufferMaxByteSize =;

constexpr uint8_t kDefaultBufferData =;
constexpr uint8_t kDummyAudioData =;

std::unique_ptr<AudioPacket> CreateAudioPacketWithSamplingRate(
    AudioPacket::SamplingRate rate,
    size_t bytes) {}

// Check that the first |bytes_written| bytes are filled with audio data and
// the rest of the buffer is unchanged.
void CheckDataBytes(const uint8_t* buffer, size_t bytes_written) {}

}  // namespace

class AudioJitterBufferTest : public ::testing::Test {};

class AudioJitterBufferTest::SimpleGetDataRequest
    : public AsyncAudioDataSupplier::GetDataRequest {};

// Test fixture definitions

void AudioJitterBufferTest::SetUp() {}

void AudioJitterBufferTest::TearDown() {}

void AudioJitterBufferTest::SetSampleRate(
    AudioPacket::SamplingRate sample_rate) {}

std::unique_ptr<AudioPacket> AudioJitterBufferTest::CreatePacket(int time_ms) {}

void AudioJitterBufferTest::AsyncConsumeData(size_t duration) {}

void AudioJitterBufferTest::VerifyStreamFormat() {}

void AudioJitterBufferTest::VerifyBuffersNotLost() {}

size_t AudioJitterBufferTest::ByteFromTime(int time_ms) const {}

size_t AudioJitterBufferTest::GetNumQueuedPackets() const {}

int AudioJitterBufferTest::GetNumQueuedTime() const {}

size_t AudioJitterBufferTest::GetNumQueuedRequests() const {}
void AudioJitterBufferTest::OnFormatChanged(const AudioStreamFormat& format) {}

// SimpleGetDataRequest definitions

AudioJitterBufferTest::SimpleGetDataRequest::SimpleGetDataRequest(
    AudioJitterBufferTest* test,
    size_t bytes_to_write)
    :{}

AudioJitterBufferTest::SimpleGetDataRequest::~SimpleGetDataRequest() {}

void AudioJitterBufferTest::SimpleGetDataRequest::OnDataFilled() {}

// Test cases

TEST_F(AudioJitterBufferTest, Init) {}

TEST_F(AudioJitterBufferTest, MultipleSamples) {}

TEST_F(AudioJitterBufferTest, ExceedLatency) {}

TEST_F(AudioJitterBufferTest, SingleAsyncRequest_UnderrunProtection) {}

TEST_F(AudioJitterBufferTest, SingleAsyncRequest_Fulfilled) {}

TEST_F(AudioJitterBufferTest, TwoAsyncRequest_FulfillOneByOne) {}

TEST_F(AudioJitterBufferTest, TwoAsyncRequest_OnePacketFulfillsTwoRequests) {}

TEST_F(AudioJitterBufferTest, TwoAsyncRequest_UnderrunProtectionKicksIn) {}

TEST_F(AudioJitterBufferTest, TwoAsyncRequest_TwoPacketsFulfillTwoRequests) {}

TEST_F(AudioJitterBufferTest, ChangeSampleRate) {}

}  // namespace remoting