API Reference

class pylibsrtp.Error

Error that occurred making a libsrtp API call.

class pylibsrtp.Policy(key=None, ssrc_type=0, ssrc_value=0)

Policy for single SRTP stream.

SSRC_ANY_INBOUND = 2

Indicates any inbound SSRC value

SSRC_ANY_OUTBOUND = 3

Indicates any inbound SSRC value

SSRC_SPECIFIC = 1

Indicates a specific SSRC value

SSRC_UNDEFINED = 0

Indicates an undefined SSRC type

property allow_repeat_tx

Whether retransmissions of packets with the same sequence number are allowed.

property key

The SRTP master key.

property ssrc_type

The SSRC type.

property ssrc_value

The SSRC value, if it is not a wildcard.

property window_size

The window size to use for replay protection.

class pylibsrtp.Session(policy=None)

SRTP session, which may comprise several streams.

If policy is not specified, streams should be added later using the add_stream() method.

add_stream(policy)

Add a stream to the SRTP session, applying the given policy to the stream.

Parameters

policyPolicy

protect(packet)

Apply SRTP protection to the RTP packet.

Parameters

packetbytes

Return type

bytes

protect_rtcp(packet)

Apply SRTCP protection to the RTCP packet.

Parameters

packetbytes

Return type

bytes

remove_stream(ssrc)

Remove the stream with the given ssrc from the SRTP session.

Parameters

ssrcint

unprotect(packet)

Verify SRTP protection of the SRTP packet.

Parameters

packetbytes

Return type

bytes

unprotect_rtcp(packet)

Verify SRTCP protection of the SRTCP packet.

Parameters

packetbytes

Return type

bytes