Add a new test to exercise emulation prevention after encryption
Also added a few more command line flags for end to end test: - no-remove_temp_files_after_test: do not remove test artifacts after test - encryption_key, encryption_iv: allow injecting encryption key/iv from command line Change-Id: I62084790e10fe6a385b90cb96d9515d8436b2a49
This commit is contained in:
parent
6347b29ad7
commit
ec904f3f79
|
@ -35,6 +35,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
self.output = None
|
||||
|
||||
def tearDown(self):
|
||||
if test_env.options.remove_temp_files_after_test:
|
||||
shutil.rmtree(self.tmp_dir)
|
||||
|
||||
def testVersion(self):
|
||||
|
@ -252,6 +253,27 @@ class PackagerAppTest(unittest.TestCase):
|
|||
os.path.join(self.tmp_dir, 'video.m3u8'),
|
||||
'bear-640x360-v-enc-golden.m3u8')
|
||||
|
||||
def testPackageAvcTsWithEncryptionExerciseEmulationPrevention(self):
|
||||
# Currently we only support live packaging for ts.
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['video'],
|
||||
output_format='ts',
|
||||
live=True,
|
||||
test_files=['sintel-1024x436.mp4']),
|
||||
self._GetFlags(
|
||||
encryption=True,
|
||||
encryption_key='ad7e9786def9159db6724be06dfcde7a',
|
||||
output_hls=True))
|
||||
self._DiffLiveGold(self.output[0],
|
||||
'sintel-1024x436-v-enc-golden',
|
||||
output_format='ts')
|
||||
self._DiffGold(self.hls_master_playlist_output,
|
||||
'sintel-1024x436-v-enc-master-golden.m3u8')
|
||||
self._DiffGold(
|
||||
os.path.join(self.tmp_dir, 'video.m3u8'),
|
||||
'sintel-1024x436-v-enc-golden.m3u8')
|
||||
|
||||
def testPackageWebmWithEncryption(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(['video'],
|
||||
|
@ -511,6 +533,8 @@ class PackagerAppTest(unittest.TestCase):
|
|||
encryption=False,
|
||||
protection_scheme=None,
|
||||
decryption=False,
|
||||
encryption_key='32333435363738393021323334353637',
|
||||
encryption_iv='3334353637383930',
|
||||
random_iv=False,
|
||||
widevine_encryption=False,
|
||||
key_rotation=False,
|
||||
|
@ -529,10 +553,15 @@ class PackagerAppTest(unittest.TestCase):
|
|||
elif encryption:
|
||||
flags += ['--enable_fixed_key_encryption',
|
||||
'--key_id=31323334353637383930313233343536',
|
||||
'--key=32333435363738393021323334353637', '--clear_lead=1']
|
||||
'--clear_lead=1']
|
||||
|
||||
if test_env.options.encryption_key:
|
||||
encryption_key = test_env.options.encryption_key
|
||||
flags.append('--key=' + encryption_key)
|
||||
if not random_iv:
|
||||
flags.append('--iv=3334353637383930')
|
||||
if test_env.options.encryption_iv:
|
||||
encryption_iv = test_env.options.encryption_iv
|
||||
flags.append('--iv=' + encryption_iv)
|
||||
if protection_scheme:
|
||||
flags += ['--protection_scheme', protection_scheme]
|
||||
|
||||
|
|
|
@ -27,6 +27,15 @@ SRC_DIR = os.path.join(SCRIPT_DIR, os.pardir, os.pardir)
|
|||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('--test_update_golden_files', default=0, type=int)
|
||||
# Overwrite the test to encryption key/iv specified in the command line.
|
||||
parser.add_argument('--encryption_key')
|
||||
parser.add_argument('--encryption_iv')
|
||||
|
||||
parser.add_argument('--remove_temp_files_after_test',
|
||||
dest='remove_test_files_after_test', action='store_true')
|
||||
parser.add_argument('--no-remove_temp_files_after_test',
|
||||
dest='remove_temp_files_after_test', action='store_false')
|
||||
parser.set_defaults(remove_temp_files_after_test=True)
|
||||
|
||||
aes = parser.add_argument_group(
|
||||
'aes flags',
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,20 @@
|
|||
#EXTM3U
|
||||
#EXT-X-VERSION:6
|
||||
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
|
||||
#EXT-X-TARGETDURATION:2
|
||||
#EXT-X-PLAYLIST-TYPE:VOD
|
||||
#EXTINF:1.000,
|
||||
output_video-1.ts
|
||||
#EXT-X-DISCONTINUITY
|
||||
#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",IV=0x3334353637383930,KEYFORMAT="identity"
|
||||
#EXTINF:1.000,
|
||||
output_video-2.ts
|
||||
#EXTINF:1.875,
|
||||
output_video-3.ts
|
||||
#EXTINF:0.917,
|
||||
output_video-4.ts
|
||||
#EXTINF:1.000,
|
||||
output_video-5.ts
|
||||
#EXTINF:0.208,
|
||||
output_video-6.ts
|
||||
#EXT-X-ENDLIST
|
|
@ -0,0 +1,4 @@
|
|||
#EXTM3U
|
||||
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
|
||||
#EXT-X-STREAM-INF:CODECS="avc1.64001f",BANDWIDTH=1183948
|
||||
video.m3u8
|
|
@ -85,3 +85,5 @@ avc-unit-stream-frame.h264 - Single IDR frame from avc-byte-stream-frame.h264 co
|
|||
|
||||
hevc-byte-stream-frame.h265 - Several video frames with SPS/PPS/VPS manually extracted from an H.265 stream, in Annex B byte stream format.
|
||||
hevc-byte-stream-frame.h265 - hevc-byte-stream-frame.h265 converted to unit stream format.
|
||||
|
||||
sintel-1024x436.mp4 - First 6 seconds of Sintel stream.
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue