示例#1
0
    def test_toBytearray_extension(self, startBits, headerExtension):
        self.thisRTP.sequenceNumber = 0
        self.thisRTP.ssrc = 0
        newExt = Extension()
        newExt.startBits = bytearray(startBits)
        newExt.headerExtension = bytearray(headerExtension)

        expected = bytearray(
            b'\x80\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
        expected[0] |= 1 << 4
        expected[12:12] = newExt.toBytearray()
        self.thisRTP.extension = newExt
        self.assertEqual(self.thisRTP.toBytearray(), expected)
示例#2
0
    def test_fromBytearray_extension(self, startBits, headerExtension):
        self.thisRTP.sequenceNumber = 0
        self.thisRTP.ssrc = 0
        newExt = Extension()
        newExt.startBits = bytearray(startBits)
        newExt.headerExtension = bytearray(headerExtension)

        payload = bytearray(
            b'\x80\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
        payload[0] |= 1 << 4
        payload[12:12] = newExt.toBytearray()
        newRTP = RTP().fromBytearray(payload)

        self.thisRTP.extension = newExt
        self.assertEqual(newRTP, self.thisRTP)