File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 39
39
]
40
40
41
41
42
+ # SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN
42
43
SRTP_MAX_TRAILER_LEN = 16 + 128
43
44
45
+ # SRTP_SRCTP_INDEX_LEN + SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN
46
+ SRTP_MAX_SRTCP_TRAILER_LEN = 4 + 16 + 128
47
+
44
48
45
49
class Error (Exception ):
46
50
"""
@@ -238,7 +242,7 @@ def protect_rtcp(self, packet: bytes) -> bytes:
238
242
:param packet: :class:`bytes`
239
243
:rtype: :class:`bytes`
240
244
"""
241
- return self .__process (packet , lib .srtp_protect_rtcp , SRTP_MAX_TRAILER_LEN )
245
+ return self .__process (packet , lib .srtp_protect_rtcp , SRTP_MAX_SRTCP_TRAILER_LEN )
242
246
243
247
def unprotect (self , packet : bytes ) -> bytes :
244
248
"""
Original file line number Diff line number Diff line change 2
2
import secrets
3
3
from unittest import TestCase
4
4
5
+ import pylibsrtp
5
6
from pylibsrtp import Error , Policy , Session
6
7
7
8
RTP = (
@@ -207,7 +208,7 @@ def test_rtp_any_ssrc(self):
207
208
208
209
# bad length
209
210
with self .assertRaises (ValueError ) as cm :
210
- tx_session .protect (b"0" * 1500 )
211
+ tx_session .protect (b"0" * ( 1501 - pylibsrtp . SRTP_MAX_TRAILER_LEN ) )
211
212
self .assertEqual (str (cm .exception ), "packet is too long" )
212
213
213
214
# unprotect RTP
@@ -244,7 +245,9 @@ def test_rtcp_any_ssrc(self):
244
245
245
246
# bad length
246
247
with self .assertRaises (ValueError ) as cm :
247
- tx_session .protect_rtcp (b"0" * 1500 )
248
+ tx_session .protect_rtcp (
249
+ b"0" * (1501 - pylibsrtp .SRTP_MAX_SRTCP_TRAILER_LEN )
250
+ )
248
251
self .assertEqual (str (cm .exception ), "packet is too long" )
249
252
250
253
# unprotect RTCP
You can’t perform that action at this time.
0 commit comments