Change "live" setting to be "segmented"

Changed the "live" setting in _GetStreams to be "segmented" so that it
make sense in a more general sense.

Change-Id: I2ceaad67653e1e2237533b68fccbc9fe3fabfc9b
This commit is contained in:
KongQun Yang 2018-02-07 13:46:11 -08:00 committed by Aaron Vaage
parent 1d6a2de5ab
commit 74f6cefb82
1 changed files with 39 additions and 29 deletions

View File

@ -80,7 +80,7 @@ class PackagerAppTest(unittest.TestCase):
stream_descriptors, stream_descriptors,
language_override=None, language_override=None,
output_format=None, output_format=None,
live=False, segmented=False,
hls=False, hls=False,
test_files=None): test_files=None):
if test_files is None: if test_files is None:
@ -105,18 +105,22 @@ class PackagerAppTest(unittest.TestCase):
stream = StreamDescriptor(test_file) stream = StreamDescriptor(test_file)
stream.Append('stream', stream_descriptor) stream.Append('stream', stream_descriptor)
if live: base_ext = self._GetExtension(stream_descriptor, output_format)
if output_format == 'ts': segment_ext = self._GetSegmentedExtension(base_ext)
stream.Append('segment_template', output_prefix + '-$Number$.ts')
else: requires_init_segment = segmented and base_ext not in ['ts', 'vtt']
stream.Append('init_segment', output_prefix + '-init.mp4')
stream.Append('segment_template', output_prefix + '-$Number$.m4s') if requires_init_segment:
init_seg = '%s-init.%s' % (output_prefix, base_ext)
stream.Append('init_segment', init_seg)
if segmented:
seg_template = '%s-$Number$.%s' % (output_prefix, segment_ext)
stream.Append('segment_template', seg_template)
self.output.append(output_prefix) self.output.append(output_prefix)
else: else:
output = '%s.%s' % ( output = '%s.%s' % (output_prefix, base_ext)
output_prefix,
self._GetExtension(stream_descriptor, output_format))
stream.Append('output', output) stream.Append('output', output)
self.output.append(output) self.output.append(output)
@ -132,7 +136,7 @@ class PackagerAppTest(unittest.TestCase):
return streams return streams
def _GetExtension(self, stream_descriptor, output_format): def _GetExtension(self, stream_descriptor, output_format):
# TODO(rkuroiwa): Support ttml. # TODO(vaage): Support ttml.
if stream_descriptor == 'text': if stream_descriptor == 'text':
return 'vtt' return 'vtt'
if output_format: if output_format:
@ -140,6 +144,12 @@ class PackagerAppTest(unittest.TestCase):
# Default to mp4. # Default to mp4.
return 'mp4' return 'mp4'
def _GetSegmentedExtension(self, base_extension):
if base_extension == 'mp4':
return 'm4s'
return base_extension
def _GetFlags(self, def _GetFlags(self,
strip_parameter_set_nalus=True, strip_parameter_set_nalus=True,
encryption=False, encryption=False,
@ -459,7 +469,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360.ts']), test_files=['bear-640x360.ts']),
self._GetFlags(output_hls=True)) self._GetFlags(output_hls=True))
@ -482,7 +492,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360-ac3.ts']), test_files=['bear-640x360-ac3.ts']),
self._GetFlags(output_hls=True)) self._GetFlags(output_hls=True))
@ -521,7 +531,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360.ts']), test_files=['bear-640x360.ts']),
self._GetFlags( self._GetFlags(
@ -548,7 +558,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360.ts']), test_files=['bear-640x360.ts']),
self._GetFlags( self._GetFlags(
@ -577,7 +587,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360.ts']), test_files=['bear-640x360.ts']),
self._GetFlags( self._GetFlags(
@ -839,7 +849,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360.ts']), test_files=['bear-640x360.ts']),
self._GetFlags(encryption=True, output_hls=True)) self._GetFlags(encryption=True, output_hls=True))
@ -864,7 +874,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360.ts']), test_files=['bear-640x360.ts']),
self._GetFlags(encryption=True, output_hls=True, fairplay=True)) self._GetFlags(encryption=True, output_hls=True, fairplay=True))
@ -889,7 +899,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['audio', 'video'], ['audio', 'video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['bear-640x360-ac3.ts']), test_files=['bear-640x360-ac3.ts']),
self._GetFlags(encryption=True, output_hls=True)) self._GetFlags(encryption=True, output_hls=True))
@ -915,7 +925,7 @@ class PackagerFunctionalTest(PackagerAppTest):
self._GetStreams( self._GetStreams(
['video'], ['video'],
output_format='ts', output_format='ts',
live=True, segmented=True,
hls=True, hls=True,
test_files=['sintel-1024x436.mp4']), test_files=['sintel-1024x436.mp4']),
self._GetFlags( self._GetFlags(
@ -1129,14 +1139,14 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfile(self): def testPackageWithLiveProfile(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetFlags()) self._GetStreams(['audio', 'video'], segmented=True), self._GetFlags())
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden') self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden')
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden') self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden')
self._DiffLiveMpdGold(self.mpd_output, 'bear-640x360-av-live-golden.mpd') self._DiffLiveMpdGold(self.mpd_output, 'bear-640x360-av-live-golden.mpd')
def testPackageWithLiveStaticProfile(self): def testPackageWithLiveStaticProfile(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags(generate_static_mpd=True)) self._GetFlags(generate_static_mpd=True))
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden') self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden')
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden') self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden')
@ -1144,7 +1154,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveStaticProfileAndAdCues(self): def testPackageWithLiveStaticProfileAndAdCues(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags(generate_static_mpd=True, ad_cues='1.5')) self._GetFlags(generate_static_mpd=True, ad_cues='1.5'))
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden') self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden')
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden') self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden')
@ -1153,7 +1163,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfileAndEncryption(self): def testPackageWithLiveProfileAndEncryption(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags(encryption=True)) self._GetFlags(encryption=True))
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-cenc-golden') self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-cenc-golden')
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-cenc-golden') self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-cenc-golden')
@ -1162,7 +1172,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfileAndEncryptionAndNonDashIfIop(self): def testPackageWithLiveProfileAndEncryptionAndNonDashIfIop(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags(encryption=True, dash_if_iop=False)) self._GetFlags(encryption=True, dash_if_iop=False))
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-cenc-golden') self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-cenc-golden')
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-cenc-golden') self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-cenc-golden')
@ -1172,7 +1182,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfileAndEncryptionAndMultFiles(self): def testPackageWithLiveProfileAndEncryptionAndMultFiles(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], self._GetStreams(['audio', 'video'],
live=True, segmented=True,
test_files=['bear-1280x720.mp4', 'bear-640x360.mp4', test_files=['bear-1280x720.mp4', 'bear-640x360.mp4',
'bear-320x180.mp4']), 'bear-320x180.mp4']),
self._GetFlags(encryption=True)) self._GetFlags(encryption=True))
@ -1184,7 +1194,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfileAndKeyRotation(self): def testPackageWithLiveProfileAndKeyRotation(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags(encryption=True, key_rotation=True)) self._GetFlags(encryption=True, key_rotation=True))
self._DiffLiveGold(self.output[0], self._DiffLiveGold(self.output[0],
'bear-640x360-a-live-cenc-rotation-golden') 'bear-640x360-a-live-cenc-rotation-golden')
@ -1195,7 +1205,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfileAndKeyRotationAndNoPsshInStream(self): def testPackageWithLiveProfileAndKeyRotationAndNoPsshInStream(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags( self._GetFlags(
encryption=True, key_rotation=True, include_pssh_in_stream=False)) encryption=True, key_rotation=True, include_pssh_in_stream=False))
self._DiffLiveGold(self.output[0], self._DiffLiveGold(self.output[0],
@ -1208,7 +1218,7 @@ class PackagerFunctionalTest(PackagerAppTest):
def testPackageWithLiveProfileAndKeyRotationAndNonDashIfIop(self): def testPackageWithLiveProfileAndKeyRotationAndNonDashIfIop(self):
self.assertPackageSuccess( self.assertPackageSuccess(
self._GetStreams(['audio', 'video'], live=True), self._GetStreams(['audio', 'video'], segmented=True),
self._GetFlags(encryption=True, self._GetFlags(encryption=True,
key_rotation=True, key_rotation=True,
dash_if_iop=False)) dash_if_iop=False))