def streamer_udp(payload_type, payload, **kwargs):
    return message.struct(header=header(payload_type=RtpPayloadType.Streamer,
                                        streamer=message.streamer(
                                            streamer_version=0,
                                            type=payload_type),
                                        **kwargs),
                          payload=payload)
def test_header_udp(packets):
    data = packets['udp_video_data'][:20]

    msg = factory.header(payload_type=enum.RtpPayloadType.Streamer,
                         connection_id=35795,
                         channel_id=1024,
                         timestamp=0,
                         padding=True,
                         streamer=message.streamer(streamer_version=0,
                                                   type=4).container)
    msg.flags(csrc_count=0, version=2, extension=False, marker=False)
    msg(sequence_num=1, csrc_list=[])
    packed = msg.build()

    assert msg.flags.version == 2
    assert msg.flags.padding is True
    assert msg.flags.extension is False
    assert msg.flags.csrc_count == 0
    assert msg.flags.marker is False
    assert msg.flags.payload_type == enum.RtpPayloadType.Streamer
    assert msg.sequence_num == 1
    assert msg.timestamp == 0
    assert msg.ssrc.connection_id == 35795
    assert msg.ssrc.channel_id == 1024
    assert len(msg.csrc_list) == 0

    assert len(packed) == len(data)
    assert packed == data
def streamer_tcp(sequence_num, prev_sequence_num, payload_type, payload,
                 **kwargs):
    return message.struct(header=header(
        payload_type=RtpPayloadType.Streamer,
        streamer=message.streamer(streamer_version=STREAMER_VERSION,
                                  sequence_num=sequence_num,
                                  prev_sequence_num=prev_sequence_num,
                                  type=payload_type),
        **kwargs),
                          payload=payload)