Create Tests For Bandwidth

Created HLS and DASH tests that include overriding the
computed bandwidth value.

Issue #389

Change-Id: I6063fe780f6a68e2e7a7ad4440c9d76bacbbffe3
This commit is contained in:
Aaron Vaage 2018-04-30 15:43:58 -07:00
parent dddbb19701
commit 902dfb905a
15 changed files with 84 additions and 0 deletions

View File

@ -150,6 +150,7 @@ class PackagerAppTest(unittest.TestCase):
trick_play_factor=None, trick_play_factor=None,
drm_label=None, drm_label=None,
skip_encryption=None, skip_encryption=None,
bandwidth=None,
test_file=None): test_file=None):
"""Get a stream descriptor as a string. """Get a stream descriptor as a string.
@ -171,6 +172,8 @@ class PackagerAppTest(unittest.TestCase):
same as not specifying a trick play factor. same as not specifying a trick play factor.
drm_label: Sets the drm label for the stream. drm_label: Sets the drm label for the stream.
skip_encryption: If set to true, the stream will not be encrypted. skip_encryption: If set to true, the stream will not be encrypted.
bandwidth: The expected bandwidth value that should be listed in the
manifest.
test_file: Specify the input file to use. If the input file is not test_file: Specify the input file to use. If the input file is not
specify, a default file will be used. specify, a default file will be used.
@ -236,6 +239,9 @@ class PackagerAppTest(unittest.TestCase):
output_file_path += '.' + base_ext output_file_path += '.' + base_ext
stream.Append('output', output_file_path) stream.Append('output', output_file_path)
if bandwidth:
stream.Append('bandwidth', bandwidth)
self.output.append(output_file_path) self.output.append(output_file_path)
return str(stream) return str(stream)
@ -1310,6 +1316,28 @@ class PackagerFunctionalTest(PackagerAppTest):
self.assertPackageSuccess(streams, flags) self.assertPackageSuccess(streams, flags)
self._CheckTestResults('hls-segmented-webvtt') self._CheckTestResults('hls-segmented-webvtt')
def testHlsWithBandwidthOverride(self):
streams = [
self._GetStream('audio', segmented=True, bandwidth=11111),
self._GetStream('video', segmented=True, bandwidth=44444)
]
flags = self._GetFlags(output_hls=True)
self.assertPackageSuccess(streams, flags)
self._CheckTestResults('hls-with-bandwidth-override')
def testDashWithBandwidthOverride(self):
streams = [
self._GetStream('audio', bandwidth=11111),
self._GetStream('video', bandwidth=44444)
]
flags = self._GetFlags()
self.assertPackageSuccess(streams, flags)
self._CheckTestResults('dash-with-bandwidth-override')
def _AssertStreamInfo(self, stream, info): def _AssertStreamInfo(self, stream, info):
stream_info = self.packager.DumpStreamInfo(stream) stream_info = self.packager.DumpStreamInfo(stream)
self.assertIn('Found 1 stream(s).', stream_info) self.assertIn('Found 1 stream(s).', stream_info)

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.802799940109253S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="30000/1001" subsegmentAlignment="true" par="16:9">
<Representation id="0" bandwidth="44444" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
<BaseURL>bear-640x360-video.mp4</BaseURL>
<SegmentBase indexRange="823-890" timescale="30000">
<Initialization range="0-822"/>
</SegmentBase>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" subsegmentAlignment="true">
<Representation id="1" bandwidth="11111" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>bear-640x360-audio.mp4</BaseURL>
<SegmentBase indexRange="757-824" timescale="44100">
<Initialization range="0-756"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>

View File

@ -0,0 +1,7 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_0.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-STREAM-INF:BANDWIDTH=55555,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group"
stream_1.m3u8

View File

@ -0,0 +1,13 @@
#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
#EXT-X-MAP:URI="bear-640x360-audio-init.mp4"
#EXTINF:1.022,
bear-640x360-audio-1.m4s
#EXTINF:0.998,
bear-640x360-audio-2.m4s
#EXTINF:0.743,
bear-640x360-audio-3.m4s
#EXT-X-ENDLIST

View File

@ -0,0 +1,13 @@
#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
#EXT-X-MAP:URI="bear-640x360-video-init.mp4"
#EXTINF:1.068,
bear-640x360-video-1.m4s
#EXTINF:1.001,
bear-640x360-video-2.m4s
#EXTINF:0.734,
bear-640x360-video-3.m4s
#EXT-X-ENDLIST