Commit 9583b0ed authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Commit Bot

MSE: Remove legacy buffering-by-DTS Part 1: Tests

MseBufferByPts was enabled by default in M75. This series of changes (in M76)
removes:

1) the tests for the old "LegacyByDts" MSE buffering logic (this change), and
2) the old "LegacyByDts" MSE buffering logic and the associated feature gating

Later changes will refactor the resulting "NewByPts" logic to remove
residual complications such as templating SourceBufferStream by range
buffering implementation and clean up confusing usage of DecodeTimestamp
where it really contains a presentation timestamp within and below
FrameProcessor.

Reduces media unittests count (roughly from 5635 to 5056).
Also, removes the LegacyByDts portion of each
mediasource_*_pipeline_integration_fuzzer

BUG=771349,760264,718641,639144
R=sandersd@chromium.org
CC=​​​​​​mmoroz@chromium.org

Change-Id: I0aca7e72abbf5353294c46876751884886382d2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1574608Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658794}
parent 42b45514
......@@ -396,15 +396,6 @@ MATCHER_P(BufferingByPtsDts, by_pts_bool, "") {
(by_pts_bool ? "PTS" : "DTS"));
}
MATCHER_P3(NegativeDtsFailureWhenByDts, frame_type, pts_us, dts_us, "") {
return CONTAINS_STRING(
arg, std::string(frame_type) + " frame with PTS " +
base::NumberToString(pts_us) + "us has negative DTS " +
base::NumberToString(dts_us) +
"us after applying timestampOffset, handling any discontinuity, "
"and filtering against append window");
}
MATCHER_P2(DiscardingEmptyFrame, pts_us, dts_us, "") {
return CONTAINS_STRING(arg,
"Discarding empty audio or video coded frame, PTS=" +
......
This diff is collapsed.
This diff is collapsed.
......@@ -22,7 +22,6 @@ namespace media {
using testing::_;
using testing::SaveArg;
using testing::Values;
namespace {
......@@ -55,11 +54,12 @@ void InvokeCbAndSaveResult(const base::Callback<bool()>& cb, bool* result) {
}
}
class SourceBufferStateTest
: public ::testing::TestWithParam<ChunkDemuxerStream::RangeApi> {
class SourceBufferStateTest : public ::testing::Test {
public:
SourceBufferStateTest() : mock_stream_parser_(nullptr) {
range_api_ = GetParam();
// TODO(wolenetz): Remove range API parameterization once production code no
// longer varies per kMseBufferByPts feature. See https://crbug.com/771349.
range_api_ = ChunkDemuxerStream::RangeApi::kNewByPts;
}
std::unique_ptr<SourceBufferState> CreateSourceBufferState() {
......@@ -157,7 +157,7 @@ class SourceBufferStateTest
ChunkDemuxerStream::RangeApi range_api_;
};
TEST_P(SourceBufferStateTest, InitSingleAudioTrack) {
TEST_F(SourceBufferStateTest, InitSingleAudioTrack) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("vorbis");
......@@ -170,7 +170,7 @@ TEST_P(SourceBufferStateTest, InitSingleAudioTrack) {
EXPECT_TRUE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, InitSingleVideoTrack) {
TEST_F(SourceBufferStateTest, InitSingleVideoTrack) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("vp8");
......@@ -183,7 +183,7 @@ TEST_P(SourceBufferStateTest, InitSingleVideoTrack) {
EXPECT_TRUE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, InitMultipleTracks) {
TEST_F(SourceBufferStateTest, InitMultipleTracks) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("vorbis,vp8,opus,vp9");
......@@ -203,7 +203,7 @@ TEST_P(SourceBufferStateTest, InitMultipleTracks) {
EXPECT_TRUE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, AudioStreamMismatchesExpectedCodecs) {
TEST_F(SourceBufferStateTest, AudioStreamMismatchesExpectedCodecs) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("opus");
std::unique_ptr<MediaTracks> tracks(new MediaTracks());
......@@ -212,7 +212,7 @@ TEST_P(SourceBufferStateTest, AudioStreamMismatchesExpectedCodecs) {
EXPECT_FALSE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, VideoStreamMismatchesExpectedCodecs) {
TEST_F(SourceBufferStateTest, VideoStreamMismatchesExpectedCodecs) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("vp9");
std::unique_ptr<MediaTracks> tracks(new MediaTracks());
......@@ -221,7 +221,7 @@ TEST_P(SourceBufferStateTest, VideoStreamMismatchesExpectedCodecs) {
EXPECT_FALSE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, MissingExpectedAudioStream) {
TEST_F(SourceBufferStateTest, MissingExpectedAudioStream) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("opus,vp9");
std::unique_ptr<MediaTracks> tracks(new MediaTracks());
......@@ -232,7 +232,7 @@ TEST_P(SourceBufferStateTest, MissingExpectedAudioStream) {
EXPECT_FALSE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, MissingExpectedVideoStream) {
TEST_F(SourceBufferStateTest, MissingExpectedVideoStream) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("opus,vp9");
std::unique_ptr<MediaTracks> tracks(new MediaTracks());
......@@ -243,7 +243,7 @@ TEST_P(SourceBufferStateTest, MissingExpectedVideoStream) {
EXPECT_FALSE(AppendDataAndReportTracks(sbs, std::move(tracks)));
}
TEST_P(SourceBufferStateTest, TrackIdsChangeInSecondInitSegment) {
TEST_F(SourceBufferStateTest, TrackIdsChangeInSecondInitSegment) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("opus,vp9");
......@@ -268,7 +268,7 @@ TEST_P(SourceBufferStateTest, TrackIdsChangeInSecondInitSegment) {
AppendDataAndReportTracks(sbs, std::move(tracks2));
}
TEST_P(SourceBufferStateTest, TrackIdChangeWithTwoAudioTracks) {
TEST_F(SourceBufferStateTest, TrackIdChangeWithTwoAudioTracks) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("vorbis,opus");
......@@ -298,7 +298,7 @@ TEST_P(SourceBufferStateTest, TrackIdChangeWithTwoAudioTracks) {
EXPECT_FALSE(AppendDataAndReportTracks(sbs, std::move(tracks3)));
}
TEST_P(SourceBufferStateTest, TrackIdChangeWithTwoVideoTracks) {
TEST_F(SourceBufferStateTest, TrackIdChangeWithTwoVideoTracks) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("vp8,vp9");
......@@ -328,7 +328,7 @@ TEST_P(SourceBufferStateTest, TrackIdChangeWithTwoVideoTracks) {
EXPECT_FALSE(AppendDataAndReportTracks(sbs, std::move(tracks3)));
}
TEST_P(SourceBufferStateTest, TrackIdsSwappedInSecondInitSegment) {
TEST_F(SourceBufferStateTest, TrackIdsSwappedInSecondInitSegment) {
std::unique_ptr<SourceBufferState> sbs =
CreateAndInitSourceBufferState("opus,vp9");
......@@ -350,11 +350,4 @@ TEST_P(SourceBufferStateTest, TrackIdsSwappedInSecondInitSegment) {
AppendDataAndReportTracks(sbs, std::move(tracks2));
}
INSTANTIATE_TEST_SUITE_P(LegacyByDts,
SourceBufferStateTest,
Values(ChunkDemuxerStream::RangeApi::kLegacyByDts));
INSTANTIATE_TEST_SUITE_P(NewByPts,
SourceBufferStateTest,
Values(ChunkDemuxerStream::RangeApi::kNewByPts));
} // namespace media
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -17,7 +17,6 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/decoder_buffer.h"
......@@ -353,37 +352,13 @@ TEST_F(MP4StreamParserTest, AVC_KeyAndNonKeyframeness_Match_Container) {
ParseMP4File("bear-640x360-v-2frames_frag.mp4", 512);
}
TEST_F(MP4StreamParserTest, LegacyByDts_AVC_Keyframeness_Mismatches_Container) {
TEST_F(MP4StreamParserTest, AVC_Keyframeness_Mismatches_Container) {
// The first AVC video frame's keyframe-ness metadata matches the MP4:
// Frame 0: AVC IDR, trun.first_sample_flags: NOT sync sample, DEPENDS on
// others.
// Frame 1: AVC Non-IDR, tfhd.default_sample_flags: not sync sample, depends
// on others.
InSequence s; // The EXPECT* sequence matters for this test.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(kMseBufferByPts);
auto params = GetDefaultInitParametersExpectations();
params.detected_audio_track_count = 0;
InitializeParserWithInitParametersExpectations(params);
verifying_keyframeness_sequence_ = true;
EXPECT_MEDIA_LOG(DebugLog(
"ISO-BMFF container metadata for video frame indicates that the frame is "
"not a keyframe, but the video frame contents indicate the opposite."));
EXPECT_CALL(*this, ParsedNonKeyframe());
EXPECT_CALL(*this, ParsedNonKeyframe());
ParseMP4File("bear-640x360-v-2frames-keyframe-is-non-sync-sample_frag.mp4",
512);
}
TEST_F(MP4StreamParserTest, NewByPts_AVC_Keyframeness_Mismatches_Container) {
// The first AVC video frame's keyframe-ness metadata matches the MP4:
// Frame 0: AVC IDR, trun.first_sample_flags: NOT sync sample, DEPENDS on
// others.
// Frame 1: AVC Non-IDR, tfhd.default_sample_flags: not sync sample, depends
// on others.
InSequence s; // The EXPECT* sequence matters for this test.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(kMseBufferByPts);
auto params = GetDefaultInitParametersExpectations();
params.detected_audio_track_count = 0;
InitializeParserWithInitParametersExpectations(params);
......@@ -397,38 +372,13 @@ TEST_F(MP4StreamParserTest, NewByPts_AVC_Keyframeness_Mismatches_Container) {
512);
}
TEST_F(MP4StreamParserTest,
LegacyByDts_AVC_NonKeyframeness_Mismatches_Container) {
// The second AVC video frame's keyframe-ness metadata matches the MP4:
// Frame 0: AVC IDR, trun.first_sample_flags: sync sample that doesn't
// depend on others.
// Frame 1: AVC Non-IDR, tfhd.default_sample_flags: SYNC sample, DOES NOT
// depend on others.
InSequence s; // The EXPECT* sequence matters for this test.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(kMseBufferByPts);
auto params = GetDefaultInitParametersExpectations();
params.detected_audio_track_count = 0;
InitializeParserWithInitParametersExpectations(params);
verifying_keyframeness_sequence_ = true;
EXPECT_CALL(*this, ParsedKeyframe());
EXPECT_MEDIA_LOG(DebugLog(
"ISO-BMFF container metadata for video frame indicates that the frame is "
"a keyframe, but the video frame contents indicate the opposite."));
EXPECT_CALL(*this, ParsedKeyframe());
ParseMP4File("bear-640x360-v-2frames-nonkeyframe-is-sync-sample_frag.mp4",
512);
}
TEST_F(MP4StreamParserTest, NewByPts_AVC_NonKeyframeness_Mismatches_Container) {
TEST_F(MP4StreamParserTest, AVC_NonKeyframeness_Mismatches_Container) {
// The second AVC video frame's keyframe-ness metadata matches the MP4:
// Frame 0: AVC IDR, trun.first_sample_flags: sync sample that doesn't
// depend on others.
// Frame 1: AVC Non-IDR, tfhd.default_sample_flags: SYNC sample, DOES NOT
// depend on others.
InSequence s; // The EXPECT* sequence matters for this test.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(kMseBufferByPts);
auto params = GetDefaultInitParametersExpectations();
params.detected_audio_track_count = 0;
InitializeParserWithInitParametersExpectations(params);
......
......@@ -248,27 +248,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
FuzzerVariant variant = PIPELINE_FUZZER_VARIANT;
if (variant == SRC) {
{
media::ProgressivePipelineIntegrationFuzzerTest test;
test.RunTest(data, size);
}
media::ProgressivePipelineIntegrationFuzzerTest test;
test.RunTest(data, size);
} else {
// Sequentially fuzz with new and old MSE buffering APIs. See
// https://crbug.com/718641.
{
base::test::ScopedFeatureList features_with_buffering_api_forced;
features_with_buffering_api_forced.InitAndEnableFeature(
media::kMseBufferByPts);
media::MediaSourcePipelineIntegrationFuzzerTest test;
test.RunTest(data, size, MseFuzzerVariantEnumToMimeTypeString(variant));
}
{
base::test::ScopedFeatureList features_with_buffering_api_forced;
features_with_buffering_api_forced.InitAndDisableFeature(
media::kMseBufferByPts);
media::MediaSourcePipelineIntegrationFuzzerTest test;
test.RunTest(data, size, MseFuzzerVariantEnumToMimeTypeString(variant));
}
media::MediaSourcePipelineIntegrationFuzzerTest test;
test.RunTest(data, size, MseFuzzerVariantEnumToMimeTypeString(variant));
}
return 0;
......
This diff is collapsed.
......@@ -11,7 +11,6 @@
#include "base/callback_forward.h"
#include "base/hash/md5.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/scoped_task_environment.h"
#include "media/audio/clockless_audio_sink.h"
#include "media/audio/null_audio_sink.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment