Commit be51f9cd authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

ice: fix PJ_EBUSY error not handled during send op

This fixes a media encoding fatal failure due to ice ioqueue
not polled enough (as poll thread != write thread).
This is fixed by modifying errno in ice send method and use it
correctly in socketpair (media layer).

Refs #77903

Change-Id: I0ca51be356df02294b3d1857a1533518fb902465
parent 91ecfb5c
......@@ -41,6 +41,7 @@
#include <sstream>
#include <chrono>
#include <thread>
#include <cerrno>
#define TRY(ret) do { \
if ((ret) != PJ_SUCCESS) \
......@@ -698,13 +699,21 @@ IceTransport::send(int comp_id, const unsigned char* buf, size_t len)
auto remote = getRemoteAddress(comp_id);
if (!remote) {
RING_ERR("Can't find remote address for component %d", comp_id);
errno = EINVAL;
return -1;
}
auto status = pj_ice_strans_sendto(icest_.get(), comp_id+1, buf, len, remote.pjPtr(), remote.getLength());
if (status != PJ_SUCCESS) {
RING_ERR("ice send failed: %s", sip_utils::sip_strerror(status).c_str());
if (status == PJ_EBUSY) {
RING_WARN("ice send busy");
errno = EAGAIN;
} else {
RING_ERR("ice send failed: %s", sip_utils::sip_strerror(status).c_str());
errno = EIO;
}
return -1;
}
return len;
}
......
......@@ -454,7 +454,7 @@ retry:
/* RTCP payload type */
ret = context->writeRtcpData(buf, buf_size);
if (ret < 0) {
if (ret == -EAGAIN)
if (errno == EAGAIN)
goto retry;
return ret;
}
......@@ -462,13 +462,13 @@ retry:
/* RTP payload type */
ret = context->writeRtpData(buf, buf_size);
if (ret < 0) {
if (ret == -EAGAIN)
if (errno == EAGAIN)
goto retry;
return ret;
}
}
return ret < 0 ? errno : ret;
return ret < 0 ? -errno : ret;
}
} // namespace ring
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