chromium/media/filters/frame_processor_unittest.cc

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

#include <stddef.h>
#include <stdint.h>

#include <cstring>
#include <map>
#include <memory>
#include <string>
#include <vector>

#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "media/base/media_log.h"
#include "media/base/media_util.h"
#include "media/base/mock_filters.h"
#include "media/base/mock_media_log.h"
#include "media/base/test_helpers.h"
#include "media/base/timestamp_constants.h"
#include "media/filters/chunk_demuxer.h"
#include "media/filters/frame_processor.h"
#include "testing/gtest/include/gtest/gtest.h"

Milliseconds;
_;
InSequence;
StrictMock;
Values;

namespace {

// Helpers to encode/decode a base::TimeDelta to/from a string, used in these
// tests to populate coded frame payloads with an encoded version of the
// original frame timestamp while (slightly) obfuscating the payload itself to
// help ensure the payload itself is neither changed by frame processing nor
// interpreted directly and mistakenly as a base::TimeDelta by frame processing.
std::string EncodeTestPayload(base::TimeDelta timestamp) {}

base::TimeDelta DecodeTestPayload(std::string_view payload) {}

}  // namespace

namespace media {

BufferQueue;
TrackId;

// Used for setting expectations on callbacks. Using a StrictMock also lets us
// test for missing or extra callbacks.
class FrameProcessorTestCallbackHelper {};

class FrameProcessorTest : public ::testing::TestWithParam<bool> {};

TEST_P(FrameProcessorTest, WrongTypeInAppendedBuffer) {}

TEST_P(FrameProcessorTest, NonMonotonicallyIncreasingTimestampInOneCall) {}

TEST_P(FrameProcessorTest, AudioOnly_SingleFrame) {}

TEST_P(FrameProcessorTest, VideoOnly_SingleFrame) {}

TEST_P(FrameProcessorTest, AudioOnly_TwoFrames) {}

TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenSingleFrame) {}

TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenFrameTimestampBelowOffset) {}

TEST_P(FrameProcessorTest, AudioOnly_SequentialProcessFrames) {}

TEST_P(FrameProcessorTest, AudioOnly_NonSequentialProcessFrames) {}

TEST_P(FrameProcessorTest, AudioVideo_SequentialProcessFrames) {}

TEST_P(FrameProcessorTest, AudioVideo_Discontinuity) {}

TEST_P(FrameProcessorTest, AudioVideo_Discontinuity_TimestampOffset) {}

TEST_P(FrameProcessorTest, AudioVideo_OutOfSequence_After_Discontinuity) {}

TEST_P(FrameProcessorTest,
       AppendWindowFilterOfNegativeBufferTimestampsWithPrerollDiscard) {}

TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) {}

TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll_2) {}

TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) {}

TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoDiscontinuity) {}

TEST_P(FrameProcessorTest,
       PartialAppendWindowFilterNoDiscontinuity_DtsAfterPts) {}

TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoNewMediaSegment) {}

TEST_P(FrameProcessorTest, AudioOnly_SequenceModeContinuityAcrossReset) {}

TEST_P(FrameProcessorTest, PartialAppendWindowZeroDurationPreroll) {}

TEST_P(FrameProcessorTest,
       OOOKeyframePrecededByDependantNonKeyframeShouldWarn) {}

TEST_P(FrameProcessorTest, OOOKeyframePts_1) {}

TEST_P(FrameProcessorTest, OOOKeyframePts_2) {}

TEST_P(FrameProcessorTest, AudioNonKeyframeChangedToKeyframe) {}

TEST_P(FrameProcessorTest, TimestampOffsetNegativeDts) {}

TEST_P(FrameProcessorTest, LargeTimestampOffsetJumpForward) {}

TEST_P(FrameProcessorTest, ContinuousDts_SapType2_and_PtsJumpForward) {}

TEST_P(FrameProcessorTest, ContinuousDts_NewGopEndOverlapsLastGop_1) {}

TEST_P(FrameProcessorTest, ContinuousDts_NewGopEndOverlapsLastGop_2) {}

TEST_P(FrameProcessorTest, ContinuousDts_NewSap2GopEndOverlapsLastGop_1) {}

TEST_P(FrameProcessorTest, ContinuousDts_NewSap2GopEndOverlapsLastGop_2) {}

TEST_P(FrameProcessorTest,
       ContinuousDts_NewSap2GopEndOverlapsLastGop_3_GopByGop) {}

TEST_P(FrameProcessorTest,
       ContinuousDts_NewSap2GopEndOverlapsLastGop_3_FrameByFrame) {}

TEST_P(FrameProcessorTest,
       ContinuousDts_NewSap2GopEndOverlapsLastGop_4_GopByGop) {}

TEST_P(FrameProcessorTest,
       ContinuousDts_NewSap2GopEndOverlapsLastGop_4_FrameByFrame) {}

TEST_P(FrameProcessorTest, ContinuousDts_GopKeyframePtsOrder_2_1_3) {}

TEST_P(FrameProcessorTest, ContinuousPts_DiscontinuousDts_AcrossGops) {}

TEST_P(FrameProcessorTest, OnlyKeyframes_ContinuousDts_ContinousPts_1) {}

TEST_P(FrameProcessorTest, OnlyKeyframes_ContinuousDts_ContinuousPts_2) {}

TEST_P(FrameProcessorTest,
       OnlyKeyframes_ContinuousDts_DiscontinuousPtsJustBeyondFudgeRoom) {}

TEST_P(FrameProcessorTest,
       GroupEndTimestampDecreaseWithinMediaSegmentShouldWarn) {}

TEST_P(FrameProcessorTest, NonkeyframeAudioBuffering_BasicOperation) {}

TEST_P(FrameProcessorTest, NonkeyframeAudioBuffering_BasicOverlaps) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_InitialNonkeyframesNotBuffered) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_InvalidDecreasingNonkeyframePts) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_ValidDecreasingKeyframePts) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_ValidSameNonKeyframePts_1) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_ValidSameNonKeyframePts_2) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_AppendWindowFilterDroppedPrerollKeyframe) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_AppendWindowFilter_TrimFront) {}

TEST_P(FrameProcessorTest,
       NonkeyframeAudioBuffering_AppendWindowFilter_TrimEnd) {}

TEST_P(FrameProcessorTest, NonkeyframeAudioBuffering_TrimSpliceOverlap) {}

TEST_P(FrameProcessorTest, FrameDuration_kNoTimestamp_Fails) {}

TEST_P(FrameProcessorTest,
       Pts_BeforeTimestampOffsetApplied_kNoTimestamp_Fails) {}

TEST_P(FrameProcessorTest,
       Pts_BeforeTimestampOffsetApplied_kInfiniteDuration_Fails) {}

TEST_P(FrameProcessorTest,
       Dts_BeforeTimestampOffsetApplied_kNoDecodeTimestamp_UsesPtsIfValid) {}

TEST_P(FrameProcessorTest,
       Dts_BeforeTimestampOffsetApplied_kMaxDecodeTimestamp_Fails) {}

TEST_P(FrameProcessorTest, After_Sequence_OffsetUpdate_kNoTimestamp_Fails) {}

TEST_P(FrameProcessorTest,
       After_Sequence_OffsetUpdate_kInfiniteDuration_Fails) {}

TEST_P(FrameProcessorTest,
       Before_Sequence_OffsetUpdate_kInfiniteDuration_Fails) {}

TEST_P(FrameProcessorTest, Segments_InfiniteTimestampOffset_Fails) {}

TEST_P(FrameProcessorTest, Pts_AfterTimestampOffsetApplied_kNoTimestamp_Fails) {}

TEST_P(FrameProcessorTest,
       Pts_AfterTimestampOffsetApplied_kInfiniteDuration_Fails) {}

TEST_P(FrameProcessorTest,
       Dts_AfterTimestampOffsetApplied_kNoDecodeTimestamp_Fails) {}

TEST_P(FrameProcessorTest,
       Dts_AfterTimestampOffsetApplied_kMaxDecodeTimestamp_Fails) {}

TEST_P(FrameProcessorTest, FrameEndTimestamp_kInfiniteDuration_Fails) {}

INSTANTIATE_TEST_SUITE_P();
INSTANTIATE_TEST_SUITE_P();

}  // namespace media