Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_rtp_packets(count, seq=0):
packets = []
for i in range(count):
packets.append(
RtpPacket(
payload_type=0,
sequence_number=uint16_add(seq, i),
ssrc=1234,
timestamp=i * 160,
)
)
return packets
encoder = get_encoder(codec)
packets = []
for frame in self.create_video_frames(width=640, height=480, count=frames):
payloads, timestamp = encoder.encode(frame)
self.assertEqual(len(payloads), 1)
packet = RtpPacket(
payload_type=codec.payloadType,
sequence_number=seq,
ssrc=1234,
timestamp=timestamp,
)
packet.payload = payloads[0]
packet.marker = 1
packets.append(packet)
seq = uint16_add(seq, 1)
return packets
def test_uint16_add(self):
self.assertEqual(uint16_add(0, 1), 1)
self.assertEqual(uint16_add(1, 1), 2)
self.assertEqual(uint16_add(1, 2), 3)
self.assertEqual(uint16_add(65534, 1), 65535)
self.assertEqual(uint16_add(65535, 1), 0)
self.assertEqual(uint16_add(65535, 3), 2)
def test_uint16_add(self):
self.assertEqual(uint16_add(0, 1), 1)
self.assertEqual(uint16_add(1, 1), 2)
self.assertEqual(uint16_add(1, 2), 3)
self.assertEqual(uint16_add(65534, 1), 65535)
self.assertEqual(uint16_add(65535, 1), 0)
self.assertEqual(uint16_add(65535, 3), 2)
def test_uint16_add(self):
self.assertEqual(uint16_add(0, 1), 1)
self.assertEqual(uint16_add(1, 1), 2)
self.assertEqual(uint16_add(1, 2), 3)
self.assertEqual(uint16_add(65534, 1), 65535)
self.assertEqual(uint16_add(65535, 1), 0)
self.assertEqual(uint16_add(65535, 3), 2)
def test_uint16_add(self):
self.assertEqual(uint16_add(0, 1), 1)
self.assertEqual(uint16_add(1, 1), 2)
self.assertEqual(uint16_add(1, 2), 3)
self.assertEqual(uint16_add(65534, 1), 65535)
self.assertEqual(uint16_add(65535, 1), 0)
self.assertEqual(uint16_add(65535, 3), 2)
def test_uint16_add(self):
self.assertEqual(uint16_add(0, 1), 1)
self.assertEqual(uint16_add(1, 1), 2)
self.assertEqual(uint16_add(1, 2), 3)
self.assertEqual(uint16_add(65534, 1), 65535)
self.assertEqual(uint16_add(65535, 1), 0)
self.assertEqual(uint16_add(65535, 3), 2)