@@ -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/**
@@ -1943,17 +1943,17 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
19431943 * The length of this RTCP packet in 32-bit words minus one,
19441944 * including the header and any padding.
19451945 */
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 ) {
19481950 int i = 0 ;
1949- /* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1950- int srtcp_len = len + 4 + 10 ;
19511951 uint8_t * pkt = av_malloc (srtcp_len );
19521952 memcpy (pkt , whip -> buf , srtcp_len );
19531953 int ret = ff_srtp_decrypt (& whip -> srtp_recv , pkt , & srtcp_len );
19541954 if (ret < 0 )
19551955 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 ) {
19571957 /**
19581958 * See https://datatracker.ietf.org/doc/html/rfc4585#section-6.1
19591959 * Handle multi NACKs in bundled packet.
0 commit comments