diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py
index 081c0afe9c..5ba6b40489 100755
--- a/packager/app/test/packager_test.py
+++ b/packager/app/test/packager_test.py
@@ -150,6 +150,7 @@ class PackagerAppTest(unittest.TestCase):
trick_play_factor=None,
drm_label=None,
skip_encryption=None,
+ bandwidth=None,
test_file=None):
"""Get a stream descriptor as a string.
@@ -171,6 +172,8 @@ class PackagerAppTest(unittest.TestCase):
same as not specifying a trick play factor.
drm_label: Sets the drm label for the stream.
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
specify, a default file will be used.
@@ -236,6 +239,9 @@ class PackagerAppTest(unittest.TestCase):
output_file_path += '.' + base_ext
stream.Append('output', output_file_path)
+ if bandwidth:
+ stream.Append('bandwidth', bandwidth)
+
self.output.append(output_file_path)
return str(stream)
@@ -1310,6 +1316,28 @@ class PackagerFunctionalTest(PackagerAppTest):
self.assertPackageSuccess(streams, flags)
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):
stream_info = self.packager.DumpStreamInfo(stream)
self.assertIn('Found 1 stream(s).', stream_info)
diff --git a/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-audio.mp4 b/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-audio.mp4
new file mode 100644
index 0000000000..d58886f965
Binary files /dev/null and b/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-audio.mp4 differ
diff --git a/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-video.mp4 b/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-video.mp4
new file mode 100644
index 0000000000..9ea15d763d
Binary files /dev/null and b/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-video.mp4 differ
diff --git a/packager/app/test/testdata/dash-with-bandwidth-override/output.mpd b/packager/app/test/testdata/dash-with-bandwidth-override/output.mpd
new file mode 100644
index 0000000000..f4f60aba84
--- /dev/null
+++ b/packager/app/test/testdata/dash-with-bandwidth-override/output.mpd
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ bear-640x360-video.mp4
+
+
+
+
+
+
+
+
+ bear-640x360-audio.mp4
+
+
+
+
+
+
+
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-1.m4s b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-1.m4s
new file mode 100644
index 0000000000..c4b4ac03d9
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-1.m4s differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-2.m4s b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-2.m4s
new file mode 100644
index 0000000000..8504387c99
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-2.m4s differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-3.m4s b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-3.m4s
new file mode 100644
index 0000000000..99af31e503
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-3.m4s differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-init.mp4
new file mode 100644
index 0000000000..f725c309e7
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-init.mp4 differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-1.m4s b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-1.m4s
new file mode 100644
index 0000000000..82605ec2c3
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-1.m4s differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-2.m4s b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-2.m4s
new file mode 100644
index 0000000000..311f93260e
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-2.m4s differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-3.m4s b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-3.m4s
new file mode 100644
index 0000000000..71e371e17a
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-3.m4s differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-init.mp4 b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-init.mp4
new file mode 100644
index 0000000000..5ed12ec053
Binary files /dev/null and b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-video-init.mp4 differ
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/output.m3u8 b/packager/app/test/testdata/hls-with-bandwidth-override/output.m3u8
new file mode 100644
index 0000000000..b07bc3df19
--- /dev/null
+++ b/packager/app/test/testdata/hls-with-bandwidth-override/output.m3u8
@@ -0,0 +1,7 @@
+#EXTM3U
+## Generated with https://github.com/google/shaka-packager version --
+
+#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
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/stream_0.m3u8 b/packager/app/test/testdata/hls-with-bandwidth-override/stream_0.m3u8
new file mode 100644
index 0000000000..08bbbd7c84
--- /dev/null
+++ b/packager/app/test/testdata/hls-with-bandwidth-override/stream_0.m3u8
@@ -0,0 +1,13 @@
+#EXTM3U
+#EXT-X-VERSION:6
+## Generated with https://github.com/google/shaka-packager version --
+#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
diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/stream_1.m3u8 b/packager/app/test/testdata/hls-with-bandwidth-override/stream_1.m3u8
new file mode 100644
index 0000000000..ac2680a454
--- /dev/null
+++ b/packager/app/test/testdata/hls-with-bandwidth-override/stream_1.m3u8
@@ -0,0 +1,13 @@
+#EXTM3U
+#EXT-X-VERSION:6
+## Generated with https://github.com/google/shaka-packager version --
+#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