Пример #1
0
 def test_parse_fu_a_2(self):
     payload = load("h264_0002.bin")
     descr, rest = H264PayloadDescriptor.parse(payload)
     self.assertEqual(descr.first_fragment, False)
     self.assertEqual(repr(descr), "H264PayloadDescriptor(FF=False)")
     self.assertNotEqual(rest[:4], b"\00\00\00\01")
     self.assertEqual(len(rest), 912)
Пример #2
0
 def test_parse_stap_a(self):
     payload = load("h264_0000.bin")
     descr, rest = H264PayloadDescriptor.parse(payload)
     self.assertEqual(descr.first_fragment, True)
     self.assertEqual(repr(descr), "H264PayloadDescriptor(FF=True)")
     self.assertEqual(rest[:4], b"\00\00\00\01")
     self.assertEqual(len(rest), 26)
Пример #3
0
 def test_parse_fu_a_1(self):
     payload = load('h264_0001.bin')
     descr, rest = H264PayloadDescriptor.parse(payload)
     self.assertEqual(descr.first_fragment, True)
     self.assertEqual(repr(descr), 'H264PayloadDescriptor(FF=True)')
     self.assertEqual(rest[:4], b'\00\00\00\01')
     self.assertEqual(len(rest), 916)
Пример #4
0
    def test_parse_stap_a_truncated(self):
        payload = load("h264_0000.bin")

        with self.assertRaises(ValueError) as cm:
            H264PayloadDescriptor.parse(payload[0:1])
        self.assertEqual(str(cm.exception), "NAL unit is too short")

        with self.assertRaises(ValueError) as cm:
            H264PayloadDescriptor.parse(payload[0:2])
        self.assertEqual(str(cm.exception), "STAP-A length field is truncated")

        with self.assertRaises(ValueError) as cm:
            H264PayloadDescriptor.parse(payload[0:3])
        self.assertEqual(str(cm.exception), "STAP-A data is truncated")
Пример #5
0
 def test_parse_fu_a_truncated(self):
     with self.assertRaises(ValueError) as cm:
         H264PayloadDescriptor.parse(b"\x7c")
     self.assertEqual(str(cm.exception), "NAL unit is too short")
Пример #6
0
 def test_parse_stap_b(self):
     with self.assertRaises(ValueError) as cm:
         H264PayloadDescriptor.parse(b"\x19\x00")
     self.assertEqual(str(cm.exception), "NAL unit type 25 is not supported")
Пример #7
0
 def test_parse_empty(self):
     with self.assertRaises(ValueError) as cm:
         H264PayloadDescriptor.parse(b'')
     self.assertEqual(str(cm.exception), 'NAL unit is too short')