#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/renderers/audio_renderer_impl.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "media/base/audio_buffer_converter.h"
#include "media/base/audio_bus.h"
#include "media/base/fake_audio_renderer_sink.h"
#include "media/base/media_client.h"
#include "media/base/media_switches.h"
#include "media/base/media_util.h"
#include "media/base/mock_audio_renderer_sink.h"
#include "media/base/mock_filters.h"
#include "media/base/mock_media_log.h"
#include "media/base/speech_recognition_client.h"
#include "media/base/test_helpers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
TimeDelta;
RunCallback;
RunOnceCallback;
_;
DoAll;
Return;
SaveArg;
namespace media {
namespace {
struct InputFrames { … };
struct OutputFrames { … };
}
constexpr AudioCodec kCodec = …;
constexpr SampleFormat kSampleFormat = …;
constexpr ChannelLayout kChannelLayout = …;
constexpr int kChannels = …;
constexpr int kInputSamplesPerSecond = …;
constexpr int kOutputSamplesPerSecond = …;
constexpr double kOutputMicrosPerFrame = …;
constexpr int kInputFramesChunk = …;
ACTION_P(EnterPendingDecoderInitStateAction, test) { … }
ACTION_P(AssertNotYetEnded, test) { … }
class AudioRendererImplTest : public ::testing::Test,
public RendererClient,
public SpeechRecognitionClient { … };
TEST_F(AudioRendererImplTest, Initialize_Successful) { … }
TEST_F(AudioRendererImplTest, Initialize_DecoderInitFailure) { … }
TEST_F(AudioRendererImplTest, ReinitializeForDifferentStream) { … }
TEST_F(AudioRendererImplTest, SignalConfigChange) { … }
TEST_F(AudioRendererImplTest, Preroll) { … }
TEST_F(AudioRendererImplTest, StartTicking) { … }
TEST_F(AudioRendererImplTest, EndOfStream) { … }
TEST_F(AudioRendererImplTest, DecoderUnderflow) { … }
TEST_F(AudioRendererImplTest, DemuxerUnderflow) { … }
TEST_F(AudioRendererImplTest, Underflow_CapacityResetsAfterFlush) { … }
TEST_F(AudioRendererImplTest, Underflow_CapacityIncreasesBeforeHaveNothing) { … }
TEST_F(AudioRendererImplTest, Underflow_OneCapacityIncreasePerUnderflow) { … }
TEST_F(AudioRendererImplTest, ChannelMask) { … }
TEST_F(AudioRendererImplTest, ChannelMask_DownmixDiscreteLayout) { … }
TEST_F(AudioRendererImplTest, Underflow_Flush) { … }
TEST_F(AudioRendererImplTest, PendingRead_Flush) { … }
TEST_F(AudioRendererImplTest, PendingRead_Destroy) { … }
TEST_F(AudioRendererImplTest, PendingFlush_Destroy) { … }
TEST_F(AudioRendererImplTest, InitializeThenDestroy) { … }
TEST_F(AudioRendererImplTest, InitializeThenDestroyDuringDecoderInit) { … }
TEST_F(AudioRendererImplTest, CurrentMediaTimeBehavior) { … }
TEST_F(AudioRendererImplTest, RenderingDelayedForEarlyStartTime) { … }
TEST_F(AudioRendererImplTest, RenderingDelayedForSuspend) { … }
TEST_F(AudioRendererImplTest, AbsurdRenderingDelayLog) { … }
TEST_F(AudioRendererImplTest, RenderingDelayDoesNotOverflow) { … }
TEST_F(AudioRendererImplTest, ImmediateEndOfStream) { … }
TEST_F(AudioRendererImplTest, OnRenderErrorCausesDecodeError) { … }
TEST_F(AudioRendererImplTest, SetPlaybackRate) { … }
TEST_F(AudioRendererImplTest, TimeSourceBehavior) { … }
TEST_F(AudioRendererImplTest, MultipleRateChangesKeepSync) { … }
TEST_F(AudioRendererImplTest, BitstreamEndOfStream) { … }
TEST_F(AudioRendererImplTest, MutedPlaybackBadDeviceInfo) { … }
TEST_F(AudioRendererImplTest, BasicMutedPlayback) { … }
TEST_F(AudioRendererImplTest, SinkIsFlushed) { … }
TEST_F(AudioRendererImplTest, LowLatencyHint) { … }
TEST_F(AudioRendererImplTest, HighLatencyHint) { … }
TEST_F(AudioRendererImplTest, PlayUnmuted) { … }
TEST_F(AudioRendererImplTest, UnmuteWhilePlaying) { … }
TEST_F(AudioRendererImplTest, DecodeAudioReadyPreemptsFlush) { … }
#if !BUILDFLAG(IS_ANDROID)
TEST_F(AudioRendererImplTest,
TranscribeAudioCallback_SpeechRecognitionDisabled) { … }
TEST_F(AudioRendererImplTest,
TranscribeAudioCallback_Muted_WithoutUserActivation) { … }
TEST_F(AudioRendererImplTest,
TranscribeAudioCallback_Unmuted_WithoutUserActivation) { … }
TEST_F(AudioRendererImplTest,
TranscribeAudioCallback_Muted_WithUserActivation) { … }
#endif
}