Add end to end test for transport stream
- Also replaces resolution to 640x360, to reduce file size. Change-Id: I030ceaa0c67c2b8f060d1864e2c3150f5d28b612
This commit is contained in:
parent
3ff74398df
commit
2abc7c60b7
|
@ -100,6 +100,24 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
self._DiffGold(self.output[2], 'subtitle-english-golden.vtt')
|
self._DiffGold(self.output[2], 'subtitle-english-golden.vtt')
|
||||||
self._DiffGold(self.mpd_output, 'bear-640x360-avt-golden.mpd')
|
self._DiffGold(self.mpd_output, 'bear-640x360-avt-golden.mpd')
|
||||||
|
|
||||||
|
def testPackageAvcTs(self):
|
||||||
|
# Currently we only support live packaging for ts.
|
||||||
|
self.packager.Package(
|
||||||
|
self._GetStreams(
|
||||||
|
['audio', 'video'],
|
||||||
|
output_format='ts',
|
||||||
|
live=True,
|
||||||
|
test_files=['bear-640x360.ts']),
|
||||||
|
self._GetFlags(live=True))
|
||||||
|
self._DiffLiveGold(self.output[0],
|
||||||
|
'bear-640x360-a-golden',
|
||||||
|
has_init_segment=False,
|
||||||
|
segment_extension='ts')
|
||||||
|
self._DiffLiveGold(self.output[1],
|
||||||
|
'bear-640x360-v-golden',
|
||||||
|
has_init_segment=False,
|
||||||
|
segment_extension='ts')
|
||||||
|
|
||||||
def testPackageVp8Webm(self):
|
def testPackageVp8Webm(self):
|
||||||
self.packager.Package(
|
self.packager.Package(
|
||||||
self._GetStreams(['video'],
|
self._GetStreams(['video'],
|
||||||
|
@ -378,10 +396,10 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
output_prefix = '%s_%d_%s' % (self.output_prefix, test_file_index,
|
output_prefix = '%s_%d_%s' % (self.output_prefix, test_file_index,
|
||||||
stream_descriptor)
|
stream_descriptor)
|
||||||
if live:
|
if live:
|
||||||
stream = ('input=%s,stream=%s,init_segment=%s-init.mp4,'
|
stream = ('input=%s,stream=%s,format=%s,init_segment=%s-init.mp4,'
|
||||||
'segment_template=%s-$Number$.m4s')
|
'segment_template=%s-$Number$.m4s')
|
||||||
streams.append(stream % (test_file, stream_descriptor, output_prefix,
|
streams.append(stream % (test_file, stream_descriptor, output_format,
|
||||||
output_prefix))
|
output_prefix, output_prefix))
|
||||||
self.output.append(output_prefix)
|
self.output.append(output_prefix)
|
||||||
else:
|
else:
|
||||||
output = '%s.%s' % (
|
output = '%s.%s' % (
|
||||||
|
@ -491,13 +509,18 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
f.write(content.replace(test_output, 'place_holder'))
|
f.write(content.replace(test_output, 'place_holder'))
|
||||||
self._DiffGold(media_info_output, golden_file_name + '.media_info')
|
self._DiffGold(media_info_output, golden_file_name + '.media_info')
|
||||||
|
|
||||||
def _DiffLiveGold(self, test_output_prefix, golden_file_name_prefix):
|
def _DiffLiveGold(self,
|
||||||
|
test_output_prefix,
|
||||||
|
golden_file_name_prefix,
|
||||||
|
has_init_segment=True,
|
||||||
|
segment_extension='m4s'):
|
||||||
# Compare init and the first three segments.
|
# Compare init and the first three segments.
|
||||||
|
if has_init_segment:
|
||||||
self._DiffGold(test_output_prefix + '-init.mp4',
|
self._DiffGold(test_output_prefix + '-init.mp4',
|
||||||
golden_file_name_prefix + '-init.mp4')
|
golden_file_name_prefix + '-init.mp4')
|
||||||
for i in range(1, 4):
|
for i in range(1, 4):
|
||||||
self._DiffGold(test_output_prefix + '-%d.m4s' % i,
|
self._DiffGold('%s-%d.m4s' % (test_output_prefix, i), '%s-%d.%s' %
|
||||||
golden_file_name_prefix + '-%d.m4s' % i)
|
(golden_file_name_prefix, i, segment_extension))
|
||||||
|
|
||||||
# Live mpd contains current availabilityStartTime and publishTime, which
|
# Live mpd contains current availabilityStartTime and publishTime, which
|
||||||
# needs to be replaced for comparison.
|
# needs to be replaced for comparison.
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -123,30 +123,29 @@ class Mp2tMediaParserTest : public testing::Test {
|
||||||
|
|
||||||
TEST_F(Mp2tMediaParserTest, UnalignedAppend17) {
|
TEST_F(Mp2tMediaParserTest, UnalignedAppend17) {
|
||||||
// Test small, non-segment-aligned appends.
|
// Test small, non-segment-aligned appends.
|
||||||
ParseMpeg2TsFile("bear-1280x720.ts", 17);
|
ParseMpeg2TsFile("bear-640x360.ts", 17);
|
||||||
EXPECT_EQ(video_frame_count_, 80);
|
EXPECT_EQ(video_frame_count_, 79);
|
||||||
EXPECT_TRUE(parser_->Flush());
|
EXPECT_TRUE(parser_->Flush());
|
||||||
EXPECT_EQ(video_frame_count_, 82);
|
EXPECT_EQ(video_frame_count_, 82);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Mp2tMediaParserTest, UnalignedAppend512) {
|
TEST_F(Mp2tMediaParserTest, UnalignedAppend512) {
|
||||||
// Test small, non-segment-aligned appends.
|
// Test small, non-segment-aligned appends.
|
||||||
ParseMpeg2TsFile("bear-1280x720.ts", 512);
|
ParseMpeg2TsFile("bear-640x360.ts", 512);
|
||||||
EXPECT_EQ(video_frame_count_, 80);
|
EXPECT_EQ(video_frame_count_, 79);
|
||||||
EXPECT_TRUE(parser_->Flush());
|
EXPECT_TRUE(parser_->Flush());
|
||||||
EXPECT_EQ(video_frame_count_, 82);
|
EXPECT_EQ(video_frame_count_, 82);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Mp2tMediaParserTest, TimestampWrapAround) {
|
TEST_F(Mp2tMediaParserTest, TimestampWrapAround) {
|
||||||
// "bear-1280x720_ptswraparound.ts" has been transcoded
|
// "bear-640x360.ts" has been transcoded from bear-640x360.mp4 by applying a
|
||||||
// from bear-1280x720.mp4 by applying a time offset of 95442s
|
// time offset of 95442s (close to 2^33 / 90000) which results in timestamps
|
||||||
// (close to 2^33 / 90000) which results in timestamps wrap around
|
// wrap around in the Mpeg2 TS stream.
|
||||||
// in the Mpeg2 TS stream.
|
ParseMpeg2TsFile("bear-640x360_ptswraparound.ts", 512);
|
||||||
ParseMpeg2TsFile("bear-1280x720_ptswraparound.ts", 512);
|
|
||||||
EXPECT_TRUE(parser_->Flush());
|
EXPECT_TRUE(parser_->Flush());
|
||||||
EXPECT_EQ(video_frame_count_, 82);
|
EXPECT_EQ(video_frame_count_, 82);
|
||||||
EXPECT_GE(video_min_dts_, static_cast<int64_t>(95443 - 1) * kMpeg2Timescale);
|
EXPECT_LT(video_min_dts_, static_cast<int64_t>(1) << 33);
|
||||||
EXPECT_LE(video_max_dts_, static_cast<int64_t>(95443 + 4) * kMpeg2Timescale);
|
EXPECT_GT(video_max_dts_, static_cast<int64_t>(1) << 33);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mp2t
|
} // namespace mp2t
|
||||||
|
|
|
@ -26,8 +26,9 @@ vorbis-packet-2 - timestamp: 0ms, duration: 0ms
|
||||||
vorbis-packet-3 - timestamp: 2902ms, duration: 0ms
|
vorbis-packet-3 - timestamp: 2902ms, duration: 0ms
|
||||||
|
|
||||||
// Transport streams.
|
// Transport streams.
|
||||||
bear-1280x720.ts - AVC + AAC encode, multiplexed into an MPEG2-TS container.
|
bear-640x360.ts - AVC + AAC encode, multiplexed into an MPEG2-TS container.
|
||||||
bear-1280x720_ptswraparound.ts - Same as bear-1280x720.ts, with a timestamp wrap-around in the middle.
|
bear-640x360_ptswraparound.ts - Same as bear-640x360.ts, with a timestamp wrap-around in the middle, created with the below command:
|
||||||
|
ffmpeg -itsoffset 95442 -i bear-640x360.ts -c:v copy -c:a copy -muxdelay 0 bear-640x360_ptswraparound.ts
|
||||||
|
|
||||||
// ISO-BMFF streams.
|
// ISO-BMFF streams.
|
||||||
bear-1280x720.mp4 - AVC + AAC encode, mulitplexed into an ISOBMFF container.
|
bear-1280x720.mp4 - AVC + AAC encode, mulitplexed into an ISOBMFF container.
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -27,7 +27,7 @@ namespace media {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const char* kMediaFiles[] = {"bear-640x360.mp4", "bear-640x360-av_frag.mp4",
|
const char* kMediaFiles[] = {"bear-640x360.mp4", "bear-640x360-av_frag.mp4",
|
||||||
"bear-1280x720.ts"};
|
"bear-640x360.ts"};
|
||||||
|
|
||||||
// Muxer options.
|
// Muxer options.
|
||||||
const double kSegmentDurationInSeconds = 1.0;
|
const double kSegmentDurationInSeconds = 1.0;
|
||||||
|
|
Loading…
Reference in New Issue