@@ -294,6 +294,7 @@ typedef struct WHIPContext {
294
294
/* The SRTP send context, to encrypt outgoing packets. */
295
295
SRTPContext srtp_audio_send ;
296
296
SRTPContext srtp_video_send ;
297
+ SRTPContext srtp_video_rtx_send ;
297
298
SRTPContext srtp_rtcp_send ;
298
299
/* The SRTP receive context, to decrypt incoming packets. */
299
300
SRTPContext srtp_recv ;
@@ -717,11 +718,11 @@ static int generate_sdp_offer(AVFormatContext *s)
717
718
"a=rtcp-fb:%u nack\r\n"
718
719
"a=rtpmap:%u rtx/90000\r\n"
719
720
"a=fmtp:%u apt=%u\r\n"
721
+ "a=ssrc-group:FID %u %u\r\n"
720
722
"a=ssrc:%u cname:FFmpeg\r\n"
721
723
"a=ssrc:%u msid:FFmpeg video\r\n"
722
724
"a=ssrc:%u cname:FFmpeg\r\n"
723
- "a=ssrc:%u msid:FFmpeg video\r\n"
724
- "a=ssrc-group:FID %u %u\r\n" ,
725
+ "a=ssrc:%u msid:FFmpeg video\r\n" ,
725
726
whip -> video_payload_type ,
726
727
whip -> rtx_payload_type ,
727
728
whip -> ice_ufrag_local ,
@@ -738,10 +739,10 @@ static int generate_sdp_offer(AVFormatContext *s)
738
739
whip -> rtx_payload_type ,
739
740
whip -> video_payload_type ,
740
741
whip -> video_ssrc ,
741
- whip -> video_ssrc ,
742
- whip -> video_rtx_ssrc ,
743
742
whip -> video_rtx_ssrc ,
744
743
whip -> video_ssrc ,
744
+ whip -> video_ssrc ,
745
+ whip -> video_rtx_ssrc ,
745
746
whip -> video_rtx_ssrc );
746
747
}
747
748
@@ -1442,6 +1443,12 @@ static int setup_srtp(AVFormatContext *s)
1442
1443
goto end ;
1443
1444
}
1444
1445
1446
+ ret = ff_srtp_set_crypto (& whip -> srtp_video_rtx_send , suite , buf );
1447
+ if (ret < 0 ) {
1448
+ av_log (whip , AV_LOG_ERROR , "WHIP: Failed to set crypto for video rtx send\n" );
1449
+ goto end ;
1450
+ }
1451
+
1445
1452
ret = ff_srtp_set_crypto (& whip -> srtp_rtcp_send , suite , buf );
1446
1453
if (ret < 0 ) {
1447
1454
av_log (whip , AV_LOG_ERROR , "Failed to set crypto for rtcp send\n" );
@@ -1583,7 +1590,7 @@ static int send_rtx_packet(AVFormatContext *s, const uint8_t * orig_pkt, int ori
1583
1590
new_size = orig_size + 2 ;
1584
1591
1585
1592
/* Encrypt by SRTP and send out. */
1586
- cipher_size = ff_srtp_encrypt (& whip -> srtp_video_send , whip -> buf , new_size , whip -> buf , sizeof (whip -> buf ));
1593
+ cipher_size = ff_srtp_encrypt (& whip -> srtp_video_rtx_send , whip -> buf , new_size , whip -> buf , sizeof (whip -> buf ));
1587
1594
if (cipher_size <= 0 || cipher_size < new_size ) {
1588
1595
av_log (whip , AV_LOG_WARNING , "WHIP: Failed to encrypt packet=%dB, cipher=%dB\n" , new_size , cipher_size );
1589
1596
return 0 ;
0 commit comments