Commit 0d100ecf authored by Éloi Bail's avatar Éloi Bail Committed by Guillaume Roguez

daemon: in case of EBUSY do not reencrypt in loop

ff_srtp_encrypt is statefull. In case of ebusy, the encryption does not
give the same packet. Now we must do it only one time

Issue: #80019
Change-Id: Id3619b0f00fa7cacd1a85557f37412059562d7fb
parent cfab4e3a
......@@ -429,19 +429,6 @@ SocketPair::writeData(uint8_t* buf, int buf_size)
{
bool isRTCP = RTP_PT_IS_RTCP(buf[1]);
// Encrypt?
if (not isRTCP and srtpContext_ and srtpContext_->srtp_out.aes) {
buf_size = ff_srtp_encrypt(&srtpContext_->srtp_out, buf,
buf_size, srtpContext_->encryptbuf,
sizeof(srtpContext_->encryptbuf));
if (buf_size < 0) {
RING_WARN("encrypt error %d", buf_size);
return buf_size;
}
buf = srtpContext_->encryptbuf;
}
// System sockets?
if (rtpHandle_ >= 0) {
int fd;
......@@ -477,6 +464,21 @@ int
SocketPair::writeCallback(uint8_t* buf, int buf_size)
{
int ret;
bool isRTCP = RTP_PT_IS_RTCP(buf[1]);
// Encrypt?
if (not isRTCP and srtpContext_ and srtpContext_->srtp_out.aes) {
buf_size = ff_srtp_encrypt(&srtpContext_->srtp_out, buf,
buf_size, srtpContext_->encryptbuf,
sizeof(srtpContext_->encryptbuf));
if (buf_size < 0) {
RING_WARN("encrypt error %d", buf_size);
return buf_size;
}
buf = srtpContext_->encryptbuf;
}
do {
if (interrupted_)
return -EINTR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment