diff --git a/res/res_srtp.c b/res/res_srtp.c index e10421cbb4c8b4d2801180eece88278a87b44d47..ea129e1299d9a183df885dac695449ae73d03622 100644 --- a/res/res_srtp.c +++ b/res/res_srtp.c @@ -504,6 +504,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;