def testNewSegmentsAdded(self):
     urlParts = [
         'livesim', 'baseurl_u10_d20', 'segtimeline_1', 'segtimelineloss_1',
         'testpic', 'Manifest.mpd'
     ]
     dp = dash_proxy.DashProvider("streamtest.eu",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=10)
     d = mpd_proxy.get_mpd(dp)
     start = d.find('<SegmentTimeline>')
     end = d.find('</SegmentTimeline>')
     testOutputFile = "SegTimeline3.txt"
     write_data_to_outfile(d[start:end + 18].encode('utf-8'),
                           testOutputFile)
     segTimeline = d[start:end + 18]
     dp2 = dash_proxy.DashProvider("streamtest.eu",
                                   urlParts,
                                   None,
                                   VOD_CONFIG_DIR,
                                   CONTENT_ROOT,
                                   now=31)
     d2 = mpd_proxy.get_mpd(dp2)
     start2 = d2.find('<SegmentTimeline>')
     end2 = d2.find('</SegmentTimeline>')
     testOutputFile = "SegTimeline4.txt"
     write_data_to_outfile(d2[start2:end2 + 18].encode('utf-8'),
                           testOutputFile)
     segTimeline2 = d2[start2:end2 + 18]
     self.assertNotEqual(segTimeline, segTimeline2)
Ejemplo n.º 2
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)
Ejemplo n.º 4
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
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
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)
Ejemplo n.º 13
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)
Ejemplo n.º 14
0
 def testBefore(self):
     self.now = 3590
     self.tsbd = 60
     urlParts = [
         'livesim', 'segtimeline_1',
         'tsbd_%d' % self.tsbd, 'testpic', 'Manifest.mpd'
     ]
     dp = dash_proxy.DashProvider("server.org",
                                  urlParts,
                                  None,
                                  VOD_CONFIG_DIR,
                                  CONTENT_ROOT,
                                  now=self.now)
     self.d = mpd_proxy.get_mpd(dp)
     self.root = ElementTree.fromstring(self.d)
     nrSegments = self.getNrSegments(self.root)
     self.assertEqual(2 * 10, nrSegments)
     write_data_to_outfile(self.d.encode('utf-8'), "BeforeWrap.mpd")
Ejemplo n.º 15
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)
Ejemplo n.º 16
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")
Ejemplo n.º 17
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
Ejemplo n.º 18
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)
Ejemplo n.º 19
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)
Ejemplo n.º 20
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)