Unverified 提交 8365c62f authored 作者: José Luis Millán's avatar José Luis Millán 提交者: GitHub

worker: Do not use references for async callbacks (#1274)

* worker: Do not use references for async callbacks

If the callback is not executed in the same uv_loop iteration, the
access to such values upon executing the callback is undefined.

* Update CHANGELOG.md
上级 c2c4323d
# Changelog # Changelog
### NEXT
* worker: Do not use references for async callbacks ([PR #1274](https://github.com/versatica/mediasoup/pull/1274)).
### 3.13.12 ### 3.13.12
* worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)). * worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
......
...@@ -89,7 +89,7 @@ namespace RTC ...@@ -89,7 +89,7 @@ namespace RTC
public: public:
void TransportConnected(); void TransportConnected();
void TransportDisconnected(); void TransportDisconnected();
void RtpPacketSent(SentInfo& sentInfo); void RtpPacketSent(const SentInfo& sentInfo);
void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback); void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback);
void EstimateAvailableBitrate(CummulativeResult& cummulativeResult); void EstimateAvailableBitrate(CummulativeResult& cummulativeResult);
void UpdateRtt(float rtt); void UpdateRtt(float rtt);
......
...@@ -69,7 +69,7 @@ namespace RTC ...@@ -69,7 +69,7 @@ namespace RTC
void TransportDisconnected(); void TransportDisconnected();
void InsertPacket(webrtc::RtpPacketSendInfo& packetInfo); void InsertPacket(webrtc::RtpPacketSendInfo& packetInfo);
webrtc::PacedPacketInfo GetPacingInfo(); webrtc::PacedPacketInfo GetPacingInfo();
void PacketSent(webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs); void PacketSent(const webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs);
void ReceiveEstimatedBitrate(uint32_t bitrate); void ReceiveEstimatedBitrate(uint32_t bitrate);
void ReceiveRtcpReceiverReport(RTC::RTCP::ReceiverReportPacket* packet, float rtt, int64_t nowMs); void ReceiveRtcpReceiverReport(RTC::RTCP::ReceiverReportPacket* packet, float rtt, int64_t nowMs);
void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback); void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback);
......
...@@ -47,7 +47,7 @@ namespace RTC ...@@ -47,7 +47,7 @@ namespace RTC
this->cummulativeResult.Reset(); this->cummulativeResult.Reset();
} }
void SenderBandwidthEstimator::RtpPacketSent(SentInfo& sentInfo) void SenderBandwidthEstimator::RtpPacketSent(const SentInfo& sentInfo)
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -2493,7 +2493,7 @@ namespace RTC ...@@ -2493,7 +2493,7 @@ namespace RTC
sentInfo.sendingAtMs = DepLibUV::GetTimeMs(); sentInfo.sendingAtMs = DepLibUV::GetTimeMs();
auto* cb = new onSendCallback( auto* cb = new onSendCallback(
[tccClientWeakPtr, &packetInfo, senderBweWeakPtr, &sentInfo](bool sent) [tccClientWeakPtr, packetInfo, senderBweWeakPtr, sentInfo](bool sent)
{ {
if (sent) if (sent)
{ {
...@@ -2517,7 +2517,7 @@ namespace RTC ...@@ -2517,7 +2517,7 @@ namespace RTC
SendRtpPacket(consumer, packet, cb); SendRtpPacket(consumer, packet, cb);
#else #else
const auto* cb = new onSendCallback( const auto* cb = new onSendCallback(
[tccClientWeakPtr, &packetInfo](bool sent) [tccClientWeakPtr, packetInfo](bool sent)
{ {
if (sent) if (sent)
{ {
...@@ -2582,7 +2582,7 @@ namespace RTC ...@@ -2582,7 +2582,7 @@ namespace RTC
sentInfo.sendingAtMs = DepLibUV::GetTimeMs(); sentInfo.sendingAtMs = DepLibUV::GetTimeMs();
auto* cb = new onSendCallback( auto* cb = new onSendCallback(
[tccClientWeakPtr, &packetInfo, senderBweWeakPtr, &sentInfo](bool sent) [tccClientWeakPtr, packetInfo, senderBweWeakPtr, sentInfo](bool sent)
{ {
if (sent) if (sent)
{ {
...@@ -2606,7 +2606,7 @@ namespace RTC ...@@ -2606,7 +2606,7 @@ namespace RTC
SendRtpPacket(consumer, packet, cb); SendRtpPacket(consumer, packet, cb);
#else #else
const auto* cb = new onSendCallback( const auto* cb = new onSendCallback(
[tccClientWeakPtr, &packetInfo](bool sent) [tccClientWeakPtr, packetInfo](bool sent)
{ {
if (sent) if (sent)
{ {
...@@ -2982,7 +2982,7 @@ namespace RTC ...@@ -2982,7 +2982,7 @@ namespace RTC
sentInfo.sendingAtMs = DepLibUV::GetTimeMs(); sentInfo.sendingAtMs = DepLibUV::GetTimeMs();
auto* cb = new onSendCallback( auto* cb = new onSendCallback(
[tccClientWeakPtr, &packetInfo, senderBweWeakPtr, &sentInfo](bool sent) [tccClientWeakPtr, packetInfo, senderBweWeakPtr, sentInfo](bool sent)
{ {
if (sent) if (sent)
{ {
...@@ -3006,7 +3006,7 @@ namespace RTC ...@@ -3006,7 +3006,7 @@ namespace RTC
SendRtpPacket(nullptr, packet, cb); SendRtpPacket(nullptr, packet, cb);
#else #else
const auto* cb = new onSendCallback( const auto* cb = new onSendCallback(
[tccClientWeakPtr, &packetInfo](bool sent) [tccClientWeakPtr, packetInfo](bool sent)
{ {
if (sent) if (sent)
{ {
......
...@@ -152,7 +152,8 @@ namespace RTC ...@@ -152,7 +152,8 @@ namespace RTC
return this->rtpTransportControllerSend->packet_sender()->GetPacingInfo(); return this->rtpTransportControllerSend->packet_sender()->GetPacingInfo();
} }
void TransportCongestionControlClient::PacketSent(webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs) void TransportCongestionControlClient::PacketSent(
const webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs)
{ {
MS_TRACE(); MS_TRACE();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论