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

Merge branch 'v3' into consumer-priority

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