Add m2ts and audio tests in packager_test
Change-Id: I11cc65a2baa69bc5e3bc022027bca6712f810f1a
This commit is contained in:
parent
e8e83cc37c
commit
53287e5fe7
|
@ -116,7 +116,7 @@ Status Fragmenter::AddSample(scoped_refptr<MediaSample> sample) {
|
||||||
} else {
|
} else {
|
||||||
// Can we safely assume the first sample in the media has the earliest
|
// Can we safely assume the first sample in the media has the earliest
|
||||||
// presentation timestamp?
|
// presentation timestamp?
|
||||||
DCHECK_GT(pts, presentation_start_time_);
|
DCHECK_GE(pts, presentation_start_time_);
|
||||||
pts -= presentation_start_time_;
|
pts -= presentation_start_time_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ using ::testing::ValuesIn;
|
||||||
namespace media {
|
namespace media {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const char* kMediaFiles[] = {"bear-1280x720.mp4", "bear-1280x720-av_frag.mp4"};
|
const char* kMediaFiles[] = {"bear-1280x720.mp4", "bear-1280x720-av_frag.mp4",
|
||||||
|
"bear-1280x720.ts"};
|
||||||
|
|
||||||
// Muxer options.
|
// Muxer options.
|
||||||
const double kSegmentDurationInSeconds = 1.0;
|
const double kSegmentDurationInSeconds = 1.0;
|
||||||
|
@ -131,6 +132,10 @@ MuxerOptions PackagerTestBasic::SetupOptions(const std::string& output,
|
||||||
options.fragment_duration = kFragmentDurationInSecodns;
|
options.fragment_duration = kFragmentDurationInSecodns;
|
||||||
options.segment_sap_aligned = kSegmentSapAligned;
|
options.segment_sap_aligned = kSegmentSapAligned;
|
||||||
options.fragment_sap_aligned = kFragmentSapAligned;
|
options.fragment_sap_aligned = kFragmentSapAligned;
|
||||||
|
// The mp4 muxer does not generate EditList, so the starting timestamp in the
|
||||||
|
// source is not carried over. Normalize the PTS so a second parse of the
|
||||||
|
// muxed output generates the same output.
|
||||||
|
options.normalize_presentation_timestamp = true;
|
||||||
options.num_subsegments_per_sidx = kNumSubsegmentsPerSidx;
|
options.num_subsegments_per_sidx = kNumSubsegmentsPerSidx;
|
||||||
|
|
||||||
options.output_file_name = GetFullPath(output);
|
options.output_file_name = GetFullPath(output);
|
||||||
|
@ -190,7 +195,7 @@ void PackagerTestBasic::Remux(const std::string& input,
|
||||||
ASSERT_OK(demuxer.Run());
|
ASSERT_OK(demuxer.Run());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentUnencrypted) {
|
TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentUnencryptedVideo) {
|
||||||
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
kOutputVideo,
|
kOutputVideo,
|
||||||
kOutputNone,
|
kOutputNone,
|
||||||
|
@ -198,7 +203,15 @@ TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentUnencrypted) {
|
||||||
kDisableEncryption));
|
kDisableEncryption));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentEncrypted) {
|
TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentUnencryptedAudio) {
|
||||||
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
|
kOutputNone,
|
||||||
|
kOutputAudio,
|
||||||
|
kSingleSegment,
|
||||||
|
kDisableEncryption));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentEncryptedVideo) {
|
||||||
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
kOutputVideo,
|
kOutputVideo,
|
||||||
kOutputNone,
|
kOutputNone,
|
||||||
|
@ -212,6 +225,20 @@ TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentEncrypted) {
|
||||||
EXPECT_TRUE(demuxer.streams()[0]->info()->is_encrypted());
|
EXPECT_TRUE(demuxer.streams()[0]->info()->is_encrypted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentEncryptedAudio) {
|
||||||
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
|
kOutputNone,
|
||||||
|
kOutputAudio,
|
||||||
|
kSingleSegment,
|
||||||
|
kEnableEncryption));
|
||||||
|
|
||||||
|
// Expect the output to be encrypted.
|
||||||
|
Demuxer demuxer(GetFullPath(kOutputAudio), decryptor_source_);
|
||||||
|
ASSERT_OK(demuxer.Initialize());
|
||||||
|
ASSERT_EQ(1u, demuxer.streams().size());
|
||||||
|
EXPECT_TRUE(demuxer.streams()[0]->info()->is_encrypted());
|
||||||
|
}
|
||||||
|
|
||||||
class PackagerTest : public PackagerTestBasic {
|
class PackagerTest : public PackagerTestBasic {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() OVERRIDE {
|
virtual void SetUp() OVERRIDE {
|
||||||
|
@ -231,7 +258,7 @@ class PackagerTest : public PackagerTestBasic {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedAgain) {
|
TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedVideoAgain) {
|
||||||
// Take the muxer output and feed into muxer again. The new muxer output
|
// Take the muxer output and feed into muxer again. The new muxer output
|
||||||
// should contain the same contents as the previous muxer output.
|
// should contain the same contents as the previous muxer output.
|
||||||
ASSERT_NO_FATAL_FAILURE(Remux(kOutputVideo,
|
ASSERT_NO_FATAL_FAILURE(Remux(kOutputVideo,
|
||||||
|
@ -242,6 +269,17 @@ TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedAgain) {
|
||||||
EXPECT_TRUE(ContentsEqual(kOutputVideo, kOutputVideo2));
|
EXPECT_TRUE(ContentsEqual(kOutputVideo, kOutputVideo2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedAudioAgain) {
|
||||||
|
// Take the muxer output and feed into muxer again. The new muxer output
|
||||||
|
// should contain the same contents as the previous muxer output.
|
||||||
|
ASSERT_NO_FATAL_FAILURE(Remux(kOutputAudio,
|
||||||
|
kOutputNone,
|
||||||
|
kOutputAudio2,
|
||||||
|
kSingleSegment,
|
||||||
|
kDisableEncryption));
|
||||||
|
EXPECT_TRUE(ContentsEqual(kOutputAudio, kOutputAudio2));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedSeparateAudioVideo) {
|
TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedSeparateAudioVideo) {
|
||||||
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
kOutputVideo2,
|
kOutputVideo2,
|
||||||
|
@ -254,7 +292,7 @@ TEST_P(PackagerTest, MP4MuxerSingleSegmentUnencryptedSeparateAudioVideo) {
|
||||||
EXPECT_TRUE(ContentsEqual(kOutputAudio, kOutputAudio2));
|
EXPECT_TRUE(ContentsEqual(kOutputAudio, kOutputAudio2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(PackagerTest, MP4MuxerMultiSegmentsUnencrypted) {
|
TEST_P(PackagerTest, MP4MuxerMultiSegmentsUnencryptedVideo) {
|
||||||
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
kOutputVideo2,
|
kOutputVideo2,
|
||||||
kOutputNone,
|
kOutputNone,
|
||||||
|
|
Loading…
Reference in New Issue