You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under stable network conditions, I expect srt_epoll_wait to block and wait for data, and then play the data once it's received. However, when there are significant changes in network conditions, such as the RTT changing from 300ms to 10ms, I hope to terminate the current SRT data transmission thread, reconfigure the latency, restart the data transmission, and play the data.
My goal is to exit the srt_epoll_wait blocked state as swiftly as possible to facilitate efficient resource cleanup. I am currently planning to use notifyExitWait to exit the blocked state, eliminating the need for the SRT data receive thread to wait for srt_epoll_wait indefinitely.
I initially sought to implement this via a system socket. Nevertheless, as epoll is Linux-specific and not available on iOS, an error occurs during iOS platform compilation stating that the sys/epoll.h and sys/eventfd.h header files cannot be found. To this end, I am considering implementing this functionality using an SRT user socket.
I would like to inquire:
Is there a difference between SRT's user socket and the system socket?
If I write an integer value 1 to the SRT socket with the intention of receiving data to exit the thread, can this be achieved?
Here is some code:
SrtEpoll::SrtEpoll() : epoll_fd_(-1), event_fd_(-1) {
int epid = srt_epoll_create();
if (epid < 0)
{
LOGE("srt_epoll_create failed, %s", srt_getlasterror_str());
return ;
}
epoll_fd_ = epid;
initExitEvent();
}
intSrtEpoll::waitReady() {
if (epoll_fd_ < 0) {
LOGE("create epoll first please!");
return -1;
}
memset(readyFds_, -1, sizeof(readyFds_));
int srtrfdslen = sizeof(readyFds_);
constint timeout_ms = -1;
returnsrt_epoll_wait(epoll_fd_, &readyFds_[0], &srtrfdslen, nullptr, nullptr, timeout_ms, nullptr,
nullptr, nullptr, nullptr);
}
voidSrtEpoll::notifyExitWait() {
intexit = 1;
if (epoll_fd_ < 0 || event_fd_ < 0) {
LOGW("epoll_fd or event_fd not valid or closed already!");
return;
}
write(event_fd_, &exit, sizeof(exit));
}
voidSrtEpoll::initExitEvent() {
if (epoll_fd_ < 0) {
LOGE("create epoll first please!");
return;
}
event_fd_ = srt_create_socket(); // sys/eventfd.h will not be found in iOS SDKif (event_fd_ < 0) {
LOGE("create eventfd failed, %s", strerror(errno));
return;
}
int events = SRT_EPOLL_IN;
if (srt_epoll_update_usock(epoll_fd_, event_fd_, &events) < 0) {
LOGE("srt_epoll_update_usock failed!");
return ;
}
}
The text was updated successfully, but these errors were encountered:
Under stable network conditions, I expect
srt_epoll_wait
to block and wait for data, and then play the data once it's received. However, when there are significant changes in network conditions, such as the RTT changing from 300ms to 10ms, I hope to terminate the current SRT data transmission thread, reconfigure the latency, restart the data transmission, and play the data.My goal is to exit the
srt_epoll_wait
blocked state as swiftly as possible to facilitate efficient resource cleanup. I am currently planning to usenotifyExitWait
to exit the blocked state, eliminating the need for the SRT data receive thread to wait forsrt_epoll_wait
indefinitely.I initially sought to implement this via a system socket. Nevertheless, as epoll is Linux-specific and not available on iOS, an error occurs during iOS platform compilation stating that the
sys/epoll.h
andsys/eventfd.h
header files cannot be found. To this end, I am considering implementing this functionality using an SRT user socket.I would like to inquire:
1
to the SRT socket with the intention of receiving data to exit the thread, can this be achieved?Here is some code:
The text was updated successfully, but these errors were encountered: