diff --git a/res/res_srtp.c b/res/res_srtp.c index 3519def7ed267a073536e1ae00a6e98e1fdbaf8e..c73d9b2ef22a1417e6193a4c13fd6f2238ab952d 100644 --- a/res/res_srtp.c +++ b/res/res_srtp.c @@ -502,6 +502,12 @@ static int ast_srtp_protect(struct ast_srtp *srtp, void **buf, int *len, int rtc memcpy(localbuf, *buf, *len); + if(rtcp){ + // align ssrc with length of 32bits. + memcpy(localbuf+4, srtp->buf+8, 4); + memcpy(srtp->rtcpbuf+4, srtp->buf+8, 4); + } + if ((res = rtcp ? srtp_protect_rtcp(srtp->session, localbuf, len) : srtp_protect(srtp->session, localbuf, len)) != err_status_ok && res != err_status_replay_fail) { ast_log(LOG_WARNING, "SRTP protect: %s\n", srtp_errstr(res)); return -1;