@@ -327,7 +327,7 @@ typedef struct WHIPContext {
327
327
int history_size ;
328
328
RtpHistoryItem * history ; /* ring buffer */
329
329
int hist_head ;
330
- int enable_nack_rtx ;
330
+ int enable_nack_rtx ; /* TODO: using whip_flags */
331
331
} WHIPContext ;
332
332
333
333
/**
@@ -1943,17 +1943,17 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
1943
1943
* The length of this RTCP packet in 32-bit words minus one,
1944
1944
* including the header and any padding.
1945
1945
*/
1946
- int len = (AV_RB16 (& whip -> buf [ptr + 2 ]) + 1 ) * 4 ;
1947
- if (ptr + len < ret && len >= 12 ) {
1946
+ int rtcp_len = (AV_RB16 (& whip -> buf [ptr + 2 ]) + 1 ) * 4 ;
1947
+ /* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1948
+ int srtcp_len = rtcp_len + 4 + 10 ;
1949
+ if (srtcp_len == ret && rtcp_len >= 12 ) {
1948
1950
int i = 0 ;
1949
- /* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1950
- int srtcp_len = len + 4 + 10 ;
1951
1951
uint8_t * pkt = av_malloc (srtcp_len );
1952
1952
memcpy (pkt , whip -> buf , srtcp_len );
1953
1953
int ret = ff_srtp_decrypt (& whip -> srtp_recv , pkt , & srtcp_len );
1954
1954
if (ret < 0 )
1955
1955
av_log (whip , AV_LOG_ERROR , "WHIP: SRTCP decrypt failed: %d\n" , ret );
1956
- while (12 + i < len && ret > = 0 ) {
1956
+ while (12 + i < rtcp_len && ret = = 0 ) {
1957
1957
/**
1958
1958
* See https://datatracker.ietf.org/doc/html/rfc4585#section-6.1
1959
1959
* Handle multi NACKs in bundled packet.
0 commit comments