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

Some pending stuff in Consumer classes

上级 3bd4f807
...@@ -25,6 +25,14 @@ namespace RTC ...@@ -25,6 +25,14 @@ namespace RTC
PipeConsumer::~PipeConsumer() PipeConsumer::~PipeConsumer()
{ {
MS_TRACE(); MS_TRACE();
for (auto& kv : this->mapMappedSsrcRtpStream)
{
auto* rtpStream = kv.second;
delete rtpStream;
}
this->mapMappedSsrcRtpStream.clear();
} }
void PipeConsumer::FillJson(json& jsonObject) const void PipeConsumer::FillJson(json& jsonObject) const
...@@ -166,9 +174,7 @@ namespace RTC ...@@ -166,9 +174,7 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// Do nothing. // Do nothing since we do not enable NACK.
// TODO: Not sure yet.
} }
void PipeConsumer::ReceiveKeyFrameRequest(RTC::RTCP::FeedbackPs::MessageType messageType) void PipeConsumer::ReceiveKeyFrameRequest(RTC::RTCP::FeedbackPs::MessageType messageType)
...@@ -191,7 +197,11 @@ namespace RTC ...@@ -191,7 +197,11 @@ namespace RTC
auto& rtpStream = kv.second; auto& rtpStream = kv.second;
if (report->GetSsrc() == ssrc) if (report->GetSsrc() == ssrc)
{
rtpStream->ReceiveRtcpReceiverReport(report); rtpStream->ReceiveRtcpReceiverReport(report);
break;
}
} }
} }
...@@ -208,7 +218,7 @@ namespace RTC ...@@ -208,7 +218,7 @@ namespace RTC
rate += rtpStream->GetRate(now); rate += rtpStream->GetRate(now);
} }
return rate / this->mapMappedSsrcRtpStream.size(); return rate;
} }
float PipeConsumer::GetLossPercentage() const float PipeConsumer::GetLossPercentage() const
...@@ -294,6 +304,7 @@ namespace RTC ...@@ -294,6 +304,7 @@ namespace RTC
for (auto& fb : mediaCodec->rtcpFeedback) for (auto& fb : mediaCodec->rtcpFeedback)
{ {
// NOTE: Do not consider NACK in PipeConsumer. // NOTE: Do not consider NACK in PipeConsumer.
if (!params.usePli && fb.type == "nack" && fb.parameter == "pli") if (!params.usePli && fb.type == "nack" && fb.parameter == "pli")
{ {
MS_DEBUG_TAG(rtcp, "PLI supported"); MS_DEBUG_TAG(rtcp, "PLI supported");
...@@ -309,8 +320,9 @@ namespace RTC ...@@ -309,8 +320,9 @@ namespace RTC
} }
// Create a RtpStreamSend for sending a single media stream. // Create a RtpStreamSend for sending a single media stream.
size_t bufferSize = params.useNack ? 1500 : 0; // NOTE: PipeConsumer does not support NACK.
auto* rtpStream = new RTC::RtpStreamSend(this, params, bufferSize); size_t bufferSize{ 0 };
auto* rtpStream = new RTC::RtpStreamSend(this, params, bufferSize);
// If the Consumer is paused, tell the RtpStreamSend. // If the Consumer is paused, tell the RtpStreamSend.
if (IsPaused() || IsProducerPaused()) if (IsPaused() || IsProducerPaused())
...@@ -344,7 +356,7 @@ namespace RTC ...@@ -344,7 +356,7 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// TODO: Not sure if we must do something here. // Do nothing.
} }
inline void PipeConsumer::OnRtpStreamRetransmitRtpPacket( inline void PipeConsumer::OnRtpStreamRetransmitRtpPacket(
......
...@@ -322,7 +322,6 @@ namespace RTC ...@@ -322,7 +322,6 @@ namespace RTC
jsonObject["rtpStreams"] = json::array(); jsonObject["rtpStreams"] = json::array();
auto jsonRtpStreamsIt = jsonObject.find("rtpStreams"); auto jsonRtpStreamsIt = jsonObject.find("rtpStreams");
size_t rtpStreamIdx{ 0 }; size_t rtpStreamIdx{ 0 };
float lossPercentage{ 0 };
for (auto& kv : this->mapSsrcRtpStream) for (auto& kv : this->mapSsrcRtpStream)
{ {
...@@ -333,16 +332,9 @@ namespace RTC ...@@ -333,16 +332,9 @@ namespace RTC
rtpStream->FillJson(jsonEntry); rtpStream->FillJson(jsonEntry);
lossPercentage += rtpStream->GetLossPercentage();
++rtpStreamIdx; ++rtpStreamIdx;
} }
if (!this->mapSsrcRtpStream.empty())
lossPercentage = lossPercentage / this->mapSsrcRtpStream.size();
// Add lossPercentage.
jsonObject["lossPercentage"] = lossPercentage;
// Add paused. // Add paused.
jsonObject["paused"] = this->paused; jsonObject["paused"] = this->paused;
} }
......
...@@ -63,7 +63,14 @@ namespace RTC ...@@ -63,7 +63,14 @@ namespace RTC
// Add rtpStream. // Add rtpStream.
this->rtpStream->FillJson(jsonObject["rtpStream"]); this->rtpStream->FillJson(jsonObject["rtpStream"]);
// TODO: Add layers, etc. // Add preferredSpatialLayer.
jsonObject["preferredSpatialLayer"] = this->preferredSpatialLayer;
// Add targetSpatialLayer.
jsonObject["targetSpatialLayer"] = this->targetSpatialLayer;
// Add currentSpatialLayer.
jsonObject["currentSpatialLayer"] = this->currentSpatialLayer;
} }
void SimulcastConsumer::FillJsonStats(json& jsonArray) const void SimulcastConsumer::FillJsonStats(json& jsonArray) const
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论