chromium/media/base/converting_audio_fifo_unittest.cc

// Copyright 2022 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 "media/base/converting_audio_fifo.h"

#include <memory>

#include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace media {

constexpr int kDefaultChannels =;
constexpr int kDefaultFrames =;
constexpr int kInputSampleRate =;

struct TestAudioParams {};

const AudioParameters kDefaultParams =;

// The combination of these values should cover all combinationso of up/down
// sampling/buffering/mixing, relative to a steady input of |kDefaultParams|.
// This does result in 27 combinations.
constexpr int kTestChannels[] =;
constexpr int kTestSampleRates[] =;
constexpr int kTestOutputFrames[] =;

class ConvertingAudioFifoTest
    : public ::testing::TestWithParam<std::tuple<int, int, int>> {};

// Verify that construction works as intended.
TEST_F(ConvertingAudioFifoTest, Construct) {}

// Verify that flushing an empty FIFO is a noop.
TEST_F(ConvertingAudioFifoTest, EmptyFlush) {}

// Verify that the fifo can be flushed .
TEST_F(ConvertingAudioFifoTest, PushFlush) {}

// Verify that the fifo can be flushed twice in a row.
TEST_F(ConvertingAudioFifoTest, PushFlushFlush) {}

// Verify that the fifo can be flushed twice.
TEST_P(ConvertingAudioFifoTest, PushFlushTwice) {}

// Verify that the fifo doesn't output until it has enough frames.
TEST_P(ConvertingAudioFifoTest, Push_NotEnoughFrames) {}

// Verify that the fifo outputs immediately if it has enough frames.
TEST_P(ConvertingAudioFifoTest, Push_EnoughFrames) {}

// Verify that the fifo produces more than one output if it has enough frames.
TEST_P(ConvertingAudioFifoTest, Push_MoreThanEnoughFrames) {}

// Verify we can partially drain the fifo before pushing more data.
TEST_P(ConvertingAudioFifoTest, Push_MoreThanEnoughFrames_PartialDrain) {}

// Verify that the FIFO returns outputs in FIFO order.
TEST_F(ConvertingAudioFifoTest, Push_MoreThanEnoughFrames_IsFifoOrder) {}

// Verify that the fifo can handle variable numbers of input frames.
TEST_P(ConvertingAudioFifoTest, Push_VaryingFrames) {}

// Verify that the fifo can handle variable numbers of input channels.
TEST_P(ConvertingAudioFifoTest, Push_VaryingChannels) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace media