@@ -327,7 +327,7 @@ typedef struct WHIPContext {
327327 int history_size ;
328328 RtpHistoryItem * history ; /* ring buffer */
329329 int hist_head ;
330- int enable_nack_rtx ;
330+ int enable_nack_rtx ; /* TODO: using whip_flags */
331331} WHIPContext ;
332332
333333/**
@@ -1937,17 +1937,17 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
19371937 * The length of this RTCP packet in 32-bit words minus one,
19381938 * including the header and any padding.
19391939 */
1940- int len = (AV_RB16 (& whip -> buf [ptr + 2 ]) + 1 ) * 4 ;
1941- if (ptr + len < ret && len >= 12 ) {
1940+ int rtcp_len = (AV_RB16 (& whip -> buf [ptr + 2 ]) + 1 ) * 4 ;
1941+ /* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1942+ int srtcp_len = rtcp_len + 4 + 10 ;
1943+ if (srtcp_len == ret && rtcp_len >= 12 ) {
19421944 int i = 0 ;
1943- /* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1944- int srtcp_len = len + 4 + 10 ;
19451945 uint8_t * pkt = av_malloc (srtcp_len );
19461946 memcpy (pkt , whip -> buf , srtcp_len );
19471947 int ret = ff_srtp_decrypt (& whip -> srtp_recv , pkt , & srtcp_len );
19481948 if (ret < 0 )
19491949 av_log (whip , AV_LOG_ERROR , "WHIP: SRTCP decrypt failed: %d\n" , ret );
1950- while (12 + i < len && ret > = 0 ) {
1950+ while (12 + i < rtcp_len && ret = = 0 ) {
19511951 /**
19521952 * See https://datatracker.ietf.org/doc/html/rfc4585#section-6.1
19531953 * Handle multi NACKs in bundled packet.
0 commit comments