def testMpdGeneration(self): testOutputFile = "MultiURL.mpd" rm_outfile(testOutputFile) urlParts = [ 'livesim', 'baseurl_u40_d20', 'baseurl_d40_u20', 'testpic', 'Manifest.mpd' ] dp = dash_proxy.DashProvider("streamtest.eu", urlParts, None, VOD_CONFIG_DIR, CONTENT_ROOT, now=0) d = mpd_proxy.get_mpd(dp) write_data_to_outfile(d.encode('utf-8'), testOutputFile) baseURLindexes = findAllIndexes("<BaseURL>", d) ud_indexes = findAllIndexes("baseurl_u40_d20", d) du_indexes = findAllIndexes("baseurl_d40_u20", d) self.assertEqual(len(baseURLindexes), 2) self.assertEqual(len(ud_indexes), 1) self.assertEqual(len(du_indexes), 1)
def testMpdWithStartNrIs1(self): "Check that startNumber=1." urlParts = ['pdash', 'snr_1', 'testpic', 'Manifest.mpd'] dp = dash_proxy.DashProvider("streamtest.eu", urlParts, None, VOD_CONFIG_DIR, CONTENT_ROOT, now=0) d = mpd_proxy.get_mpd(dp) self.assertEqual(len(findAllIndexes('startNumber="1"', d)), 2) self.assertTrue( d.find('availabilityStartTime="1970-01-01T00:00:00Z"') > 0)
def testMultiPeriod(self): testOutputFile = "multiperiod.mpd" rm_outfile(testOutputFile) urlParts = ['pdash', 'periods_10', 'testpic', 'Manifest.mpd'] dp = dash_proxy.DashProvider("streamtest.eu", urlParts, None, VOD_CONFIG_DIR, CONTENT_ROOT, now=3602) d = mpd_proxy.get_mpd(dp) write_data_to_outfile(d.encode('utf-8'), testOutputFile) periodPositions = findAllIndexes("<Period", d) self.assertEqual(len(periodPositions), 2)
def testMpdGenerationHttps(self): urlParts = [ 'livesim', 'baseurl_u40_d20', 'baseurl_d40_u20', 'testpic', 'Manifest.mpd' ] dp = dash_proxy.DashProvider("streamtest.eu", urlParts, None, VOD_CONFIG_DIR, CONTENT_ROOT, now=0, is_https=True) d = mpd_proxy.get_mpd(dp) httpsIndexes = findAllIndexes("<BaseURL>https://", d) self.assertEqual(len(httpsIndexes), 2)
def testMpdWithNormalStartNr(self): "Check that startNumber=0." urlParts = ['pdash', 'testpic', 'Manifest.mpd'] dp = dash_proxy.DashProvider("streamtest.eu", urlParts, None, VOD_CONFIG_DIR, CONTENT_ROOT, now=0) d = mpd_proxy.get_mpd(dp) with open(join(OUT_DIR, 'tmp.mpd'), 'wb') as ofh: ofh.write(d.encode('utf-8')) self.assertEqual(len(findAllIndexes('startNumber="0"', d)), 2) self.assertTrue( d.find('availabilityStartTime="1970-01-01T00:00:00Z"') > 0)
def testContinuous(self): testOutputFile = "ContMultiperiod.mpd" rm_outfile(testOutputFile) urlParts = [ 'pdash', 'continuous_1', 'periods_10', 'testpic', 'Manifest.mpd' ] dp = dash_proxy.DashProvider("streamtest.eu", urlParts, None, VOD_CONFIG_DIR, CONTENT_ROOT, now=3602) d = mpd_proxy.get_mpd(dp) write_data_to_outfile(d.encode('utf-8'), testOutputFile) periodPositions = findAllIndexes( "urn:mpeg:dash:period_continuity:2014", d) self.assertGreater(len(periodPositions), 1)