提交 aa59c5b9 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Merge branch 'v3' into consumer-priority

# Changelog # Changelog
### 3.3.0 (WIP) ### 3.3.2
* Improve "packet" event by not firing both "keyframe" and "rtp" types for the same RTP packet.
### 3.3.1
* Add type "keyframe" as a valid type for "packet" event in `Producers` and `Consumers`.
### 3.3.0
* Add transport-cc bandwidth estimation and congestion control in sender and receiver side. * Add transport-cc bandwidth estimation and congestion control in sender and receiver side.
* Run in Windows. * Run in Windows.
......
...@@ -85,7 +85,7 @@ class Worker extends EnhancedEventEmitter_1.default { ...@@ -85,7 +85,7 @@ class Worker extends EnhancedEventEmitter_1.default {
// options // options
{ {
env: { env: {
MEDIASOUP_VERSION: '3.3.1' MEDIASOUP_VERSION: '3.3.2'
}, },
detached: false, detached: false,
// fd 0 (stdin) : Just ignore it. // fd 0 (stdin) : Just ignore it.
......
...@@ -29,7 +29,7 @@ exports.types = types; ...@@ -29,7 +29,7 @@ exports.types = types;
/** /**
* Expose mediasoup version. * Expose mediasoup version.
*/ */
exports.version = '3.3.1'; exports.version = '3.3.2';
/** /**
* Expose parseScalabilityMode() function. * Expose parseScalabilityMode() function.
*/ */
......
{ {
"name": "mediasoup", "name": "mediasoup",
"version": "3.3.1", "version": "3.3.2",
"description": "Cutting Edge WebRTC Video Conferencing", "description": "Cutting Edge WebRTC Video Conferencing",
"contributors": [ "contributors": [
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)", "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
......
...@@ -97,7 +97,7 @@ namespace RTC ...@@ -97,7 +97,7 @@ namespace RTC
virtual float GetRtt() const = 0; virtual float GetRtt() const = 0;
protected: protected:
void EmitPacketEventRtpType(RTC::RtpPacket* packet, bool isRtx = false) const; void EmitPacketEventRtpAndKeyFrameTypes(RTC::RtpPacket* packet, bool isRtx = false) const;
void EmitPacketEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx = false) const; void EmitPacketEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx = false) const;
void EmitPacketEventPliType(uint32_t ssrc) const; void EmitPacketEventPliType(uint32_t ssrc) const;
void EmitPacketEventFirType(uint32_t ssrc) const; void EmitPacketEventFirType(uint32_t ssrc) const;
......
...@@ -111,7 +111,7 @@ namespace RTC ...@@ -111,7 +111,7 @@ namespace RTC
bool MangleRtpPacket(RTC::RtpPacket* packet, RTC::RtpStreamRecv* rtpStream) const; bool MangleRtpPacket(RTC::RtpPacket* packet, RTC::RtpStreamRecv* rtpStream) const;
void PostProcessRtpPacket(RTC::RtpPacket* packet); void PostProcessRtpPacket(RTC::RtpPacket* packet);
void EmitScore() const; void EmitScore() const;
void EmitPacketEventRtpType(RTC::RtpPacket* packet, bool isRtx = false) const; void EmitPacketEventRtpAndKeyFrameTypes(RTC::RtpPacket* packet, bool isRtx = false) const;
void EmitPacketEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx = false) const; void EmitPacketEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx = false) const;
void EmitPacketEventPliType(uint32_t ssrc) const; void EmitPacketEventPliType(uint32_t ssrc) const;
void EmitPacketEventFirType(uint32_t ssrc) const; void EmitPacketEventFirType(uint32_t ssrc) const;
......
...@@ -408,48 +408,40 @@ namespace RTC ...@@ -408,48 +408,40 @@ namespace RTC
this->listener->OnConsumerProducerClosed(this); this->listener->OnConsumerProducerClosed(this);
} }
void Consumer::EmitPacketEventRtpType(RTC::RtpPacket* packet, bool isRtx) const void Consumer::EmitPacketEventRtpAndKeyFrameTypes(RTC::RtpPacket* packet, bool isRtx) const
{ {
MS_TRACE(); MS_TRACE();
if (!this->packetEventTypes.rtp) if (this->packetEventTypes.keyframe && packet->IsKeyFrame())
return; {
json data = json::object();
json data = json::object();
data["type"] = "rtp";
data["timestamp"] = DepLibUV::GetTimeMs();
data["direction"] = "out";
packet->FillJson(data["info"]);
if (isRtx)
data["info"]["isRtx"] = true;
Channel::Notifier::Emit(this->id, "packet", data); data["type"] = "keyframe";
} data["timestamp"] = DepLibUV::GetTimeMs();
data["direction"] = "out";
void Consumer::EmitPacketEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx) const packet->FillJson(data["info"]);
{
MS_TRACE();
if (!this->packetEventTypes.keyframe) if (isRtx)
return; data["info"]["isRtx"] = true;
else if (!packet->IsKeyFrame())
return;
json data = json::object(); Channel::Notifier::Emit(this->id, "packet", data);
}
else if (this->packetEventTypes.rtp)
{
json data = json::object();
data["type"] = "keyframe"; data["type"] = "rtp";
data["timestamp"] = DepLibUV::GetTimeMs(); data["timestamp"] = DepLibUV::GetTimeMs();
data["direction"] = "out"; data["direction"] = "out";
packet->FillJson(data["info"]); packet->FillJson(data["info"]);
if (isRtx) if (isRtx)
data["info"]["isRtx"] = true; data["info"]["isRtx"] = true;
Channel::Notifier::Emit(this->id, "packet", data); Channel::Notifier::Emit(this->id, "packet", data);
}
} }
void Consumer::EmitPacketEventPliType(uint32_t ssrc) const void Consumer::EmitPacketEventPliType(uint32_t ssrc) const
......
...@@ -238,8 +238,7 @@ namespace RTC ...@@ -238,8 +238,7 @@ namespace RTC
this->listener->OnConsumerSendRtpPacket(this, packet); this->listener->OnConsumerSendRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet); EmitPacketEventRtpAndKeyFrameTypes(packet);
EmitPacketEventKeyFrameType(packet);
} }
else else
{ {
...@@ -567,7 +566,6 @@ namespace RTC ...@@ -567,7 +566,6 @@ namespace RTC
this->listener->OnConsumerRetransmitRtpPacket(this, packet); this->listener->OnConsumerRetransmitRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet, rtpStream->HasRtx()); EmitPacketEventRtpAndKeyFrameTypes(packet, rtpStream->HasRtx());
EmitPacketEventKeyFrameType(packet, rtpStream->HasRtx());
} }
} // namespace RTC } // namespace RTC
...@@ -617,8 +617,7 @@ namespace RTC ...@@ -617,8 +617,7 @@ namespace RTC
return result; return result;
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet, isRtx); EmitPacketEventRtpAndKeyFrameTypes(packet, isRtx);
EmitPacketEventKeyFrameType(packet, isRtx);
// Mangle the packet before providing the listener with it. // Mangle the packet before providing the listener with it.
if (!MangleRtpPacket(packet, rtpStream)) if (!MangleRtpPacket(packet, rtpStream))
...@@ -1343,48 +1342,40 @@ namespace RTC ...@@ -1343,48 +1342,40 @@ namespace RTC
Channel::Notifier::Emit(this->id, "score", data); Channel::Notifier::Emit(this->id, "score", data);
} }
inline void Producer::EmitPacketEventRtpType(RTC::RtpPacket* packet, bool isRtx) const inline void Producer::EmitPacketEventRtpAndKeyFrameTypes(RTC::RtpPacket* packet, bool isRtx) const
{ {
MS_TRACE(); MS_TRACE();
if (!this->packetEventTypes.rtp) if (this->packetEventTypes.keyframe && packet->IsKeyFrame())
return; {
json data = json::object();
json data = json::object();
data["type"] = "rtp";
data["timestamp"] = DepLibUV::GetTimeMs();
data["direction"] = "in";
packet->FillJson(data["info"]);
if (isRtx)
data["info"]["isRtx"] = true;
Channel::Notifier::Emit(this->id, "packet", data); data["type"] = "keyframe";
} data["timestamp"] = DepLibUV::GetTimeMs();
data["direction"] = "in";
inline void Producer::EmitPacketEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx) const packet->FillJson(data["info"]);
{
MS_TRACE();
if (!this->packetEventTypes.keyframe) if (isRtx)
return; data["info"]["isRtx"] = true;
else if (!packet->IsKeyFrame())
return;
json data = json::object(); Channel::Notifier::Emit(this->id, "packet", data);
}
else if (this->packetEventTypes.rtp)
{
json data = json::object();
data["type"] = "keyframe"; data["type"] = "rtp";
data["timestamp"] = DepLibUV::GetTimeMs(); data["timestamp"] = DepLibUV::GetTimeMs();
data["direction"] = "in"; data["direction"] = "in";
packet->FillJson(data["info"]); packet->FillJson(data["info"]);
if (isRtx) if (isRtx)
data["info"]["isRtx"] = true; data["info"]["isRtx"] = true;
Channel::Notifier::Emit(this->id, "packet", data); Channel::Notifier::Emit(this->id, "packet", data);
}
} }
inline void Producer::EmitPacketEventPliType(uint32_t ssrc) const inline void Producer::EmitPacketEventPliType(uint32_t ssrc) const
......
...@@ -236,8 +236,7 @@ namespace RTC ...@@ -236,8 +236,7 @@ namespace RTC
this->listener->OnConsumerSendRtpPacket(this, packet); this->listener->OnConsumerSendRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet); EmitPacketEventRtpAndKeyFrameTypes(packet);
EmitPacketEventKeyFrameType(packet);
} }
else else
{ {
...@@ -518,7 +517,6 @@ namespace RTC ...@@ -518,7 +517,6 @@ namespace RTC
this->listener->OnConsumerRetransmitRtpPacket(this, packet); this->listener->OnConsumerRetransmitRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet, this->rtpStream->HasRtx()); EmitPacketEventRtpAndKeyFrameTypes(packet, this->rtpStream->HasRtx());
EmitPacketEventKeyFrameType(packet, this->rtpStream->HasRtx());
} }
} // namespace RTC } // namespace RTC
...@@ -889,8 +889,7 @@ namespace RTC ...@@ -889,8 +889,7 @@ namespace RTC
this->listener->OnConsumerSendRtpPacket(this, packet); this->listener->OnConsumerSendRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet); EmitPacketEventRtpAndKeyFrameTypes(packet);
EmitPacketEventKeyFrameType(packet);
} }
else else
{ {
...@@ -1495,7 +1494,6 @@ namespace RTC ...@@ -1495,7 +1494,6 @@ namespace RTC
this->listener->OnConsumerRetransmitRtpPacket(this, packet); this->listener->OnConsumerRetransmitRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet, this->rtpStream->HasRtx()); EmitPacketEventRtpAndKeyFrameTypes(packet, this->rtpStream->HasRtx());
EmitPacketEventKeyFrameType(packet, this->rtpStream->HasRtx());
} }
} // namespace RTC } // namespace RTC
...@@ -640,8 +640,7 @@ namespace RTC ...@@ -640,8 +640,7 @@ namespace RTC
this->listener->OnConsumerSendRtpPacket(this, packet); this->listener->OnConsumerSendRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet); EmitPacketEventRtpAndKeyFrameTypes(packet);
EmitPacketEventKeyFrameType(packet);
} }
else else
{ {
...@@ -1108,7 +1107,6 @@ namespace RTC ...@@ -1108,7 +1107,6 @@ namespace RTC
this->listener->OnConsumerRetransmitRtpPacket(this, packet); this->listener->OnConsumerRetransmitRtpPacket(this, packet);
// May emit 'packet' event. // May emit 'packet' event.
EmitPacketEventRtpType(packet, this->rtpStream->HasRtx()); EmitPacketEventRtpAndKeyFrameTypes(packet, this->rtpStream->HasRtx());
EmitPacketEventKeyFrameType(packet, this->rtpStream->HasRtx());
} }
} // namespace RTC } // namespace RTC
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论