Esempio n. 1
0
 def testThatThereAreMultiplePeriods(self):
     "Check that the first segment starts less than one period before now-tsbd."
     testOutputFile = "segtimeline_periods.mpd"
     rm_outfile(testOutputFile)
     write_data_to_outfile(self.d.encode('utf-8'), testOutputFile)
     self.root = ElementTree.fromstring(self.d)
     periods = self.root.findall(node_ns('Period'))
     self.assertGreater(len(periods), 1)
 def testMpdGeneration(self):
     "Check if availabilityTimeOffset is added correctly to the MPD file."
     testOutputFile = "ato.mpd"
     rm_outfile(testOutputFile)
     urlParts = ['livesim', 'ato_30', '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)
     self.assertEqual(d.find('availabilityTimeOffset="30')-d.find('<BaseURL'), len('<BaseURL')+1)
Esempio n. 3
0
 def testThatSomeFeaturesAreAbsent(self):
     testOutputFile = "segtimelinenr.mpd"
     rm_outfile(testOutputFile)
     write_data_to_outfile(self.d.encode('utf-8'), testOutputFile)
     self.assertTrue(
         self.d.find("duration") ==
         -1)  # There should be no duration in the segmentTemplate
     self.assertTrue(self.d.find("$Time$") == -1)  # There should be no
     # $Number$ in template
     self.assertTrue(self.d.find("maxSegmentDuration") ==
                     -1)  # There should be no maxSegmentDuration in MPD
Esempio n. 4
0
 def testInitMux(self):
     testOutputFile = "test_mux_init.mp4"
     rm_outfile(testOutputFile)
     now = 1356998460
     urlParts = ['pdash', 'testpic', 'V1__A1', "init.mp4"]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_init(dp)
     write_data_to_outfile(d, testOutputFile)
Esempio n. 5
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)
Esempio n. 6
0
 def testMediaSegmentWithSidx(self):
     testOutputFile = "t1_sidx.m4s"
     rm_outfile(testOutputFile)
     now = 2101  # 1s after start of segment 350
     segment = "349.m4s"
     urlParts = ['pdash', 'sidx_1', 'testpic', 'A1', segment]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_media(dp)
     write_data_to_outfile(d, testOutputFile)
Esempio n. 7
0
 def testMediaMux(self):
     testOutputFile = "test_mux.m4s"
     rm_outfile(testOutputFile)
     now = 1356998460
     segment = "%d.m4s" % ((now - 60) // 6)
     urlParts = ['pdash', 'testpic', 'V1__A1', segment]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_media(dp)
     write_data_to_outfile(d, testOutputFile)
Esempio n. 8
0
 def testMediaSegmentForTfdt32(self):
     testOutputFile = "t1.m4s"
     rm_outfile(testOutputFile)
     now = 2101  # 1s after start of segment 350
     segment = "349.m4s"
     urlParts = ['pdash', 'tfdt_32', 'testpic', 'A1', segment]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_media(dp)
     write_data_to_outfile(d, testOutputFile)
     self.assertEqual(len(d), 39517)
Esempio n. 9
0
 def testMPDwithChangedAST(self):
     "Put AST to 1200s later than epoch start. There should be no PTO and startNumber=0 still."
     testOutputFile = "start.mpd"
     rm_outfile(testOutputFile)
     urlParts = ['pdash', 'start_1200', '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)
     self.assertTrue(
         d.find('availabilityStartTime="1970-01-01T00:20:00Z"') > 0)
     self.assertTrue(d.find('startNumber="0"') > 0)
     self.assertTrue(d.find('presentationTimeOffset') < 0)
 def testTtmlSegment(self):
     testOutputFile = "sub.m4s"
     rm_outfile(testOutputFile)
     segmentNr = 718263000
     segment = "%d.m4s" % segmentNr
     now = segmentNr * 2 + 10
     urlParts = ['livsim', 'ato_inf', 'testpic_stpp', 'S1', segment]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_media(dp)
     write_data_to_outfile(d, testOutputFile)
     self.assertTrue(d.find(b'begin="399035:00:00.000"') > 0)
     self.assertTrue(d.find(b'eng : UTC = 2015-07-10T11:00:00Z') > 0)
Esempio n. 11
0
 def testScte35Event(self):
     testOutputFile = "seg_scte35.m4s"
     rm_outfile(testOutputFile)
     segDur = 6
     segNr = 1800000
     now = segNr * segDur + 50
     segment = "%d.m4s" % segNr
     urlParts = ['pdash', 'scte35_3', 'testpic', 'V1', segment]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_media(dp)
     self.assertEqual(d.find(b'emsg'), 28)
     write_data_to_outfile(d, testOutputFile)
Esempio n. 12
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)
Esempio n. 13
0
 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)
Esempio n. 14
0
 def testTfdtValueFromZero(self):
     "Tfdt value = mediaPresentationTime which corresponds to segmentNr*duration"
     now = 1393936560
     segNr = 232322749
     segment = "%d.m4s" % segNr
     urlParts = ['pdash', 'testpic', 'V1', segment]
     dp = dash_proxy.DashProvider("127.0.0.1",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=now)
     d = dash_proxy.get_media(dp)
     rm_outfile('tmp.m4s')
     tmp_name = join(OUT_DIR, 'tmp.m4s')
     with open(tmp_name, 'wb') as ofh:
         ofh.write(d)
     mf = MediaSegmentFilter(tmp_name)
     mf.filter()
     rm_outfile('tmp.m4s')
     tfdtValue = mf.tfdt_value
     presentationTime = tfdtValue // 90000
     segmentTime = segNr * 6
     self.assertEqual(presentationTime, segmentTime)
Esempio n. 15
0
 def testThatSegmentTimeLineDataIsPresent(self):
     testOutputFile = "segtimelinenr.mpd"
     rm_outfile(testOutputFile)
     write_data_to_outfile(self.d.encode('utf-8'), testOutputFile)
     self.assertTrue(self.d.find("$Number$") > 0, "$Number$ missing")
Esempio n. 16
0
 def testThatSegmentTimeLineDataIsPresent(self):
     testOutputFile = "segtimeline.mpd"
     rm_outfile(testOutputFile)
     write_data_to_outfile(self.d.encode('utf-8'), testOutputFile)
     self.assertTrue(
         self.d.find("$Time$") > 0)  # There should be $Time$ in the MPD
Esempio n. 17
0
 def testInitMuxing(self):
     testOutputFile = "init_muxed.mp4"
     rm_outfile(testOutputFile)
     mi = segmentmuxer.MultiplexInits(V1_INIT, A1_INIT)
     muxed = mi.construct_muxed()
     write_data_to_outfile(muxed, testOutputFile)
Esempio n. 18
0
 def testFragmentMuxing(self):
     testOutputFile = "1_fmux.mp4s"
     rm_outfile(testOutputFile)
     ml = segmentmuxer.MultiplexMediaSegments(V1_1, A1_1)
     fmux = ml.mux_on_fragment_level()
     write_data_to_outfile(fmux, testOutputFile)
Esempio n. 19
0
 def testSampleMuxing(self):
     testOutputFile = "1_smux.m4s"
     rm_outfile(testOutputFile)
     ml = segmentmuxer.MultiplexMediaSegments(V1_1, A1_1)
     smux = ml.mux_on_sample_level()
     write_data_to_outfile(smux, testOutputFile)