WebRTC: Fix race condition in RTC nack timer callbacks. v7.0.79 (#4474)
See [WebRTC: Fix race condition in RTC publish timer
callbacks.](421ab6c3fb)
v7.0.76 (https://github.com/ossrs/srs/pull/4470)
This commit is contained in:
parent
57e1622e81
commit
8f09c4186e
|
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
||||||
<a name="v7-changes"></a>
|
<a name="v7-changes"></a>
|
||||||
|
|
||||||
## SRS 7.0 Changelog
|
## SRS 7.0 Changelog
|
||||||
|
* v7.0, 2025-09-05, Merge [#4474](https://github.com/ossrs/srs/pull/4474): WebRTC: Fix race condition in RTC nack timer callbacks. v7.0.79 (#4474)
|
||||||
* v7.0, 2025-09-04, Merge [#4467](https://github.com/ossrs/srs/pull/4467): WebRTC: Fix NACK recovered packets not being added to receive queue. v7.0.78 (#4467)
|
* v7.0, 2025-09-04, Merge [#4467](https://github.com/ossrs/srs/pull/4467): WebRTC: Fix NACK recovered packets not being added to receive queue. v7.0.78 (#4467)
|
||||||
* v7.0, 2025-09-03, Merge [#4469](https://github.com/ossrs/srs/pull/4469): Upgrade HTTP parser from http-parser to llhttp. v7.0.77 (#4469)
|
* v7.0, 2025-09-03, Merge [#4469](https://github.com/ossrs/srs/pull/4469): Upgrade HTTP parser from http-parser to llhttp. v7.0.77 (#4469)
|
||||||
* v7.0, 2025-09-03, Merge [#4470](https://github.com/ossrs/srs/pull/4470): RTX: Fix race condition for timer. v7.0.76 (#4470)
|
* v7.0, 2025-09-03, Merge [#4470](https://github.com/ossrs/srs/pull/4470): RTX: Fix race condition for timer. v7.0.76 (#4470)
|
||||||
|
|
|
||||||
|
|
@ -1745,18 +1745,29 @@ void SrsRtcPublishStream::update_send_report_time(uint32_t ssrc, const SrsNtp &n
|
||||||
|
|
||||||
SrsRtcConnectionNackTimer::SrsRtcConnectionNackTimer(SrsRtcConnection *p) : p_(p)
|
SrsRtcConnectionNackTimer::SrsRtcConnectionNackTimer(SrsRtcConnection *p) : p_(p)
|
||||||
{
|
{
|
||||||
|
lock_ = srs_mutex_new();
|
||||||
_srs_shared_timer->timer20ms()->subscribe(this);
|
_srs_shared_timer->timer20ms()->subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRtcConnectionNackTimer::~SrsRtcConnectionNackTimer()
|
SrsRtcConnectionNackTimer::~SrsRtcConnectionNackTimer()
|
||||||
{
|
{
|
||||||
_srs_shared_timer->timer20ms()->unsubscribe(this);
|
if (true) {
|
||||||
|
SrsLocker(lock_);
|
||||||
|
_srs_shared_timer->timer20ms()->unsubscribe(this);
|
||||||
|
}
|
||||||
|
srs_mutex_destroy(lock_);
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcConnectionNackTimer::on_timer(srs_utime_t interval)
|
srs_error_t SrsRtcConnectionNackTimer::on_timer(srs_utime_t interval)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
// This is a very heavy function, and it may potentially cause a coroutine switch.
|
||||||
|
// Therefore, during this function, the 'this' pointer might become invalid because
|
||||||
|
// the object could be freed by another thread. As a result, we must lock the object
|
||||||
|
// to prevent it from being freed.
|
||||||
|
SrsLocker(lock_);
|
||||||
|
|
||||||
if (!p_->nack_enabled_) {
|
if (!p_->nack_enabled_) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,7 @@ class SrsRtcConnectionNackTimer : public ISrsFastTimer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SrsRtcConnection *p_;
|
SrsRtcConnection *p_;
|
||||||
|
srs_mutex_t lock_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SrsRtcConnectionNackTimer(SrsRtcConnection *p);
|
SrsRtcConnectionNackTimer(SrsRtcConnection *p);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 7
|
#define VERSION_MAJOR 7
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 78
|
#define VERSION_REVISION 79
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user