BugFix: MediaSource unregister after 3 seconds after calling close_streams (#3132)

To avoid frequent creation and destruction of UdpSession,
RtpSession will be destructed 3 seconds after triggering onError.
This commit is contained in:
648540858 2023-12-15 16:46:43 +08:00 committed by GitHub
parent c0bb7db476
commit a72d87cca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,11 +46,7 @@ RtpSession::RtpSession(const Socket::Ptr &sock)
}
}
RtpSession::~RtpSession() {
if (_process) {
RtpSelector::Instance().delProcess(_stream_id, _process.get());
}
}
RtpSession::~RtpSession() = default;
void RtpSession::onRecv(const Buffer::Ptr &data) {
if (_is_udp) {
@ -62,6 +58,9 @@ void RtpSession::onRecv(const Buffer::Ptr &data) {
void RtpSession::onError(const SockException &err) {
WarnP(this) << _stream_id << " " << err;
if (_process) {
RtpSelector::Instance().delProcess(_stream_id, _process.get());
}
}
void RtpSession::onManager() {