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

WIP: BWE

上级 0b322bf5
...@@ -50,6 +50,7 @@ namespace RTC ...@@ -50,6 +50,7 @@ namespace RTC
RTC::RtpParameters::Type GetType() const; RTC::RtpParameters::Type GetType() const;
const std::vector<uint32_t>& GetMediaSsrcs() const; const std::vector<uint32_t>& GetMediaSsrcs() const;
virtual bool IsActive() const; virtual bool IsActive() const;
virtual void SetBitrateExternallyManaged();
void TransportConnected(); void TransportConnected();
void TransportDisconnected(); void TransportDisconnected();
bool IsPaused() const; bool IsPaused() const;
...@@ -61,6 +62,7 @@ namespace RTC ...@@ -61,6 +62,7 @@ namespace RTC
virtual void ProducerRtpStreamScore( virtual void ProducerRtpStreamScore(
RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0; RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0;
void ProducerClosed(); void ProducerClosed();
virtual uint32_t UseBitrate(uint32_t bitrate);
virtual void SendRtpPacket(RTC::RtpPacket* packet) = 0; virtual void SendRtpPacket(RTC::RtpPacket* packet) = 0;
virtual void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) = 0; virtual void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) = 0;
virtual void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) = 0; virtual void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) = 0;
...@@ -137,6 +139,11 @@ namespace RTC ...@@ -137,6 +139,11 @@ namespace RTC
this->transportConnected && !this->paused && !this->producerPaused && !this->producerClosed); this->transportConnected && !this->paused && !this->producerPaused && !this->producerClosed);
} }
inline void Consumer::SetBitrateExternallyManaged()
{
// Do nothing.
}
inline bool Consumer::IsPaused() const inline bool Consumer::IsPaused() const
{ {
return this->paused; return this->paused;
......
...@@ -20,9 +20,11 @@ namespace RTC ...@@ -20,9 +20,11 @@ namespace RTC
void FillJsonScore(json& jsonObject) const override; void FillJsonScore(json& jsonObject) const override;
void HandleRequest(Channel::Request* request) override; void HandleRequest(Channel::Request* request) override;
bool IsActive() const override; bool IsActive() const override;
void SetBitrateExternallyManaged() override;
void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override; void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override; void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override; void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
virtual uint32_t UseBitrate(uint32_t bitrate) override;
void SendRtpPacket(RTC::RtpPacket* packet) override; void SendRtpPacket(RTC::RtpPacket* packet) override;
void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) override; void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) override;
void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) override; void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) override;
...@@ -40,9 +42,11 @@ namespace RTC ...@@ -40,9 +42,11 @@ namespace RTC
void CreateRtpStream(); void CreateRtpStream();
void RequestKeyFrame(); void RequestKeyFrame();
void RetransmitRtpPacket(RTC::RtpPacket* packet); void RetransmitRtpPacket(RTC::RtpPacket* packet);
void EmitScore() const;
void UpdateCurrentLayers(); void UpdateCurrentLayers();
void RecalculateTargetSpatialLayer(); void RecalculateTargetLayers();
void RecalculateAndApplyTargetLayers();
void EmitScore() const;
void EmitLayersChange() const;
RTC::RtpStream* GetProducerCurrentRtpStream() const; RTC::RtpStream* GetProducerCurrentRtpStream() const;
RTC::RtpStream* GetProducerTargetRtpStream() const; RTC::RtpStream* GetProducerTargetRtpStream() const;
...@@ -61,13 +65,14 @@ namespace RTC ...@@ -61,13 +65,14 @@ namespace RTC
bool syncRequired{ false }; bool syncRequired{ false };
RTC::SeqManager<uint16_t> rtpSeqManager; RTC::SeqManager<uint16_t> rtpSeqManager;
RTC::SeqManager<uint32_t> rtpTimestampManager; RTC::SeqManager<uint32_t> rtpTimestampManager;
std::unique_ptr<RTC::Codecs::EncodingContext> encodingContext;
int16_t preferredSpatialLayer{ -1 }; int16_t preferredSpatialLayer{ -1 };
int16_t preferredTemporalLayer{ -1 }; int16_t preferredTemporalLayer{ -1 };
int16_t targetSpatialLayer{ -1 }; int16_t targetSpatialLayer{ -1 };
int16_t targetTemporalLayer{ -1 }; int16_t targetTemporalLayer{ -1 };
int16_t currentSpatialLayer{ -1 }; int16_t currentSpatialLayer{ -1 };
int16_t currentTemporalLayer{ -1 }; int16_t currentTemporalLayer{ -1 };
std::unique_ptr<RTC::Codecs::EncodingContext> encodingContext;
bool bitrateExternallyManaged{ false };
}; };
/* Inline methods. */ /* Inline methods. */
...@@ -85,6 +90,11 @@ namespace RTC ...@@ -85,6 +90,11 @@ namespace RTC
); );
// clang-format on // clang-format on
} }
inline void SimulcastConsumer::SetBitrateExternallyManaged()
{
this->bitrateExternallyManaged = false;
}
} // namespace RTC } // namespace RTC
#endif #endif
...@@ -25,7 +25,7 @@ namespace Channel ...@@ -25,7 +25,7 @@ namespace Channel
MS_ASSERT(Notifier::channel != nullptr, "channel unset"); MS_ASSERT(Notifier::channel != nullptr, "channel unset");
json jsonNotification(json::object()); json jsonNotification = json::object();
jsonNotification["targetId"] = targetId; jsonNotification["targetId"] = targetId;
jsonNotification["event"] = event; jsonNotification["event"] = event;
...@@ -39,7 +39,7 @@ namespace Channel ...@@ -39,7 +39,7 @@ namespace Channel
MS_ASSERT(Notifier::channel != nullptr, "channel unset"); MS_ASSERT(Notifier::channel != nullptr, "channel unset");
json jsonNotification(json::object()); json jsonNotification = json::object();
jsonNotification["targetId"] = targetId; jsonNotification["targetId"] = targetId;
jsonNotification["event"] = event; jsonNotification["event"] = event;
......
...@@ -108,7 +108,7 @@ namespace Channel ...@@ -108,7 +108,7 @@ namespace Channel
this->replied = true; this->replied = true;
json jsonResponse(json::object()); json jsonResponse = json::object();
jsonResponse["id"] = this->id; jsonResponse["id"] = this->id;
jsonResponse["accepted"] = true; jsonResponse["accepted"] = true;
...@@ -124,7 +124,7 @@ namespace Channel ...@@ -124,7 +124,7 @@ namespace Channel
this->replied = true; this->replied = true;
json jsonResponse(json::object()); json jsonResponse = json::object();
jsonResponse["id"] = this->id; jsonResponse["id"] = this->id;
jsonResponse["accepted"] = true; jsonResponse["accepted"] = true;
...@@ -143,7 +143,7 @@ namespace Channel ...@@ -143,7 +143,7 @@ namespace Channel
this->replied = true; this->replied = true;
json jsonResponse(json::object()); json jsonResponse = json::object();
jsonResponse["id"] = this->id; jsonResponse["id"] = this->id;
jsonResponse["error"] = "Error"; jsonResponse["error"] = "Error";
...@@ -162,7 +162,7 @@ namespace Channel ...@@ -162,7 +162,7 @@ namespace Channel
this->replied = true; this->replied = true;
json jsonResponse(json::object()); json jsonResponse = json::object();
jsonResponse["id"] = this->id; jsonResponse["id"] = this->id;
jsonResponse["error"] = "TypeError"; jsonResponse["error"] = "TypeError";
......
...@@ -183,7 +183,7 @@ namespace RTC ...@@ -183,7 +183,7 @@ namespace RTC
{ {
case Channel::Request::MethodId::CONSUMER_DUMP: case Channel::Request::MethodId::CONSUMER_DUMP:
{ {
json data(json::object()); json data = json::object();
FillJson(data); FillJson(data);
...@@ -194,7 +194,7 @@ namespace RTC ...@@ -194,7 +194,7 @@ namespace RTC
case Channel::Request::MethodId::CONSUMER_GET_STATS: case Channel::Request::MethodId::CONSUMER_GET_STATS:
{ {
json data(json::array()); json data = json::array();
FillJsonStats(data); FillJsonStats(data);
...@@ -326,4 +326,13 @@ namespace RTC ...@@ -326,4 +326,13 @@ namespace RTC
this->listener->onConsumerProducerClosed(this); this->listener->onConsumerProducerClosed(this);
} }
uint32_t Consumer::UseBitrate(uint32_t /*bitrate*/)
{
MS_TRACE();
// This method must be override by subclasses with layers. By default
// it just returns 0.
return 0;
}
} // namespace RTC } // namespace RTC
...@@ -226,7 +226,7 @@ namespace RTC ...@@ -226,7 +226,7 @@ namespace RTC
} }
// Tell the caller about the selected local DTLS role. // Tell the caller about the selected local DTLS role.
json data(json::object()); json data = json::object();
this->tuple->FillJson(data["tuple"]); this->tuple->FillJson(data["tuple"]);
......
...@@ -400,7 +400,7 @@ namespace RTC ...@@ -400,7 +400,7 @@ namespace RTC
} }
// Tell the caller about the selected local DTLS role. // Tell the caller about the selected local DTLS role.
json data(json::object()); json data = json::object();
this->tuple->FillJson(data["tuple"]); this->tuple->FillJson(data["tuple"]);
......
...@@ -312,7 +312,7 @@ namespace RTC ...@@ -312,7 +312,7 @@ namespace RTC
{ {
case Channel::Request::MethodId::PRODUCER_DUMP: case Channel::Request::MethodId::PRODUCER_DUMP:
{ {
json data(json::object()); json data = json::object();
FillJson(data); FillJson(data);
...@@ -323,7 +323,7 @@ namespace RTC ...@@ -323,7 +323,7 @@ namespace RTC
case Channel::Request::MethodId::PRODUCER_GET_STATS: case Channel::Request::MethodId::PRODUCER_GET_STATS:
{ {
json data(json::array()); json data = json::array();
FillJsonStats(data); FillJsonStats(data);
......
...@@ -37,9 +37,6 @@ namespace RTC ...@@ -37,9 +37,6 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// TODO: REMOVE
MS_ERROR("remb:%" PRIu64, remb->GetBitrate());
uint64_t now = DepLibUV::GetTime(); uint64_t now = DepLibUV::GetTime();
// If we don't have recent data yet, start from here. // If we don't have recent data yet, start from here.
......
...@@ -134,7 +134,7 @@ namespace RTC ...@@ -134,7 +134,7 @@ namespace RTC
{ {
case Channel::Request::MethodId::ROUTER_DUMP: case Channel::Request::MethodId::ROUTER_DUMP:
{ {
json data(json::object()); json data = json::object();
FillJson(data); FillJson(data);
...@@ -158,7 +158,7 @@ namespace RTC ...@@ -158,7 +158,7 @@ namespace RTC
MS_DEBUG_DEV("WebRtcTransport created [transportId:%s]", transportId.c_str()); MS_DEBUG_DEV("WebRtcTransport created [transportId:%s]", transportId.c_str());
json data(json::object()); json data = json::object();
webRtcTransport->FillJson(data); webRtcTransport->FillJson(data);
...@@ -181,7 +181,7 @@ namespace RTC ...@@ -181,7 +181,7 @@ namespace RTC
MS_DEBUG_DEV("PlainRtpTransport created [transportId:%s]", transportId.c_str()); MS_DEBUG_DEV("PlainRtpTransport created [transportId:%s]", transportId.c_str());
json data(json::object()); json data = json::object();
plainRtpTransport->FillJson(data); plainRtpTransport->FillJson(data);
...@@ -204,7 +204,7 @@ namespace RTC ...@@ -204,7 +204,7 @@ namespace RTC
MS_DEBUG_DEV("PipeTransport created [transportId:%s]", transportId.c_str()); MS_DEBUG_DEV("PipeTransport created [transportId:%s]", transportId.c_str());
json data(json::object()); json data = json::object();
pipeTransport->FillJson(data); pipeTransport->FillJson(data);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// #define MS_LOG_DEV // #define MS_LOG_DEV
#include "RTC/SimpleConsumer.hpp" #include "RTC/SimpleConsumer.hpp"
#include "DepLibUV.hpp"
#include "Logger.hpp" #include "Logger.hpp"
#include "MediaSoupErrors.hpp" #include "MediaSoupErrors.hpp"
#include "Channel/Notifier.hpp" #include "Channel/Notifier.hpp"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// #define MS_LOG_DEV // #define MS_LOG_DEV
#include "RTC/SimulcastConsumer.hpp" #include "RTC/SimulcastConsumer.hpp"
#include "DepLibUV.hpp"
#include "Logger.hpp" #include "Logger.hpp"
#include "MediaSoupErrors.hpp" #include "MediaSoupErrors.hpp"
#include "Channel/Notifier.hpp" #include "Channel/Notifier.hpp"
...@@ -221,14 +222,20 @@ namespace RTC ...@@ -221,14 +222,20 @@ namespace RTC
request->Accept(); request->Accept();
// clang-format off
if ( if (
IsActive() && (this->preferredSpatialLayer != previousPreferredSpatialLayer || IsActive() &&
this->preferredTemporalLayer != previousPreferredTemporalLayer)) (
this->preferredSpatialLayer != previousPreferredSpatialLayer ||
this->preferredTemporalLayer != previousPreferredTemporalLayer
)
)
// clang-format on
{ {
this->listener->OnConsumerNeedBitrateChange(this); if (this->bitrateExternallyManaged)
this->listener->OnConsumerNeedBitrateChange(this);
// TODO: No. else
RecalculateTargetSpatialLayer(); RecalculateAndApplyTargetLayers();
} }
break; break;
...@@ -269,12 +276,13 @@ namespace RTC ...@@ -269,12 +276,13 @@ namespace RTC
if (IsActive()) if (IsActive())
{ {
this->listener->OnConsumerNeedBitrateChange(this); if (this->bitrateExternallyManaged)
this->listener->OnConsumerNeedBitrateChange(this);
// TODO: No. else
RecalculateTargetSpatialLayer(); RecalculateAndApplyTargetLayers();
} }
// TODO: Should just do it if the new stream has been selected.
// Emit the score event. // Emit the score event.
EmitScore(); EmitScore();
} }
...@@ -292,14 +300,27 @@ namespace RTC ...@@ -292,14 +300,27 @@ namespace RTC
// redistribution. // redistribution.
} }
// TODO: NO, we just can downgrade layers.
if (IsActive()) if (IsActive())
RecalculateTargetSpatialLayer(); {
if (this->bitrateExternallyManaged)
this->listener->OnConsumerNeedBitrateChange(this);
else
RecalculateAndApplyTargetLayers();
}
// TODO: Should just do it if the stream is the selected one.
// Emit the score event. // Emit the score event.
EmitScore(); EmitScore();
} }
uint32_t SimulcastConsumer::UseBitrate(uint32_t bitrate)
{
MS_TRACE();
// TODO.
return bitrate;
}
void SimulcastConsumer::SendRtpPacket(RTC::RtpPacket* packet) void SimulcastConsumer::SendRtpPacket(RTC::RtpPacket* packet)
{ {
MS_TRACE(); MS_TRACE();
...@@ -329,7 +350,20 @@ namespace RTC ...@@ -329,7 +350,20 @@ namespace RTC
if (this->keyFrameSupported && !packet->IsKeyFrame()) if (this->keyFrameSupported && !packet->IsKeyFrame())
return; return;
// Change current spatial layer. // If the new current spatial layer is the preferred one honor the preferred
// temporal layer.
if (this->targetSpatialLayer == this->preferredSpatialLayer)
{
this->targetTemporalLayer = this->preferredTemporalLayer;
}
// Otherwise, choose the highest temporal layer.
// TODO: No, target temporal layer could be less (as per BWE).
else
{
this->targetTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
}
// Update current spatial and temporal layers.
UpdateCurrentLayers(); UpdateCurrentLayers();
// Need to resync the stream. // Need to resync the stream.
...@@ -383,7 +417,7 @@ namespace RTC ...@@ -383,7 +417,7 @@ namespace RTC
return; return;
} }
// Update temporal layer only if we are sending the target spatial layer. // Update current temporal layer if the packet honors the target temporal layer.
if ( if (
this->currentTemporalLayer != this->targetTemporalLayer && this->currentTemporalLayer != this->targetTemporalLayer &&
packet->GetTemporalLayer() == this->targetTemporalLayer) packet->GetTemporalLayer() == this->targetTemporalLayer)
...@@ -552,10 +586,11 @@ namespace RTC ...@@ -552,10 +586,11 @@ namespace RTC
if (IsActive()) if (IsActive())
{ {
this->rtpStream->Resume(); this->rtpStream->Resume();
this->listener->OnConsumerNeedBitrateChange(this);
// TODO: No. if (this->bitrateExternallyManaged)
RecalculateTargetSpatialLayer(); this->listener->OnConsumerNeedBitrateChange(this);
else
RecalculateAndApplyTargetLayers();
} }
} }
...@@ -576,7 +611,7 @@ namespace RTC ...@@ -576,7 +611,7 @@ namespace RTC
this->encodingContext->preferences.temporalLayer = this->rtpStream->GetTemporalLayers() - 1; this->encodingContext->preferences.temporalLayer = this->rtpStream->GetTemporalLayers() - 1;
} }
// TODO: Emit JS event? EmitLayersChange();
} }
void SimulcastConsumer::UserOnPaused() void SimulcastConsumer::UserOnPaused()
...@@ -596,7 +631,7 @@ namespace RTC ...@@ -596,7 +631,7 @@ namespace RTC
this->encodingContext->preferences.temporalLayer = this->rtpStream->GetTemporalLayers() - 1; this->encodingContext->preferences.temporalLayer = this->rtpStream->GetTemporalLayers() - 1;
} }
// TODO: Emit JS event? EmitLayersChange();
} }
void SimulcastConsumer::UserOnResumed() void SimulcastConsumer::UserOnResumed()
...@@ -608,10 +643,11 @@ namespace RTC ...@@ -608,10 +643,11 @@ namespace RTC
if (IsActive()) if (IsActive())
{ {
this->rtpStream->Resume(); this->rtpStream->Resume();
this->listener->OnConsumerNeedBitrateChange(this);
// TODO: No. if (this->bitrateExternallyManaged)
RecalculateTargetSpatialLayer(); this->listener->OnConsumerNeedBitrateChange(this);
else
RecalculateAndApplyTargetLayers();
} }
} }
...@@ -726,17 +762,6 @@ namespace RTC ...@@ -726,17 +762,6 @@ namespace RTC
} }
} }
inline void SimulcastConsumer::EmitScore() const
{
MS_TRACE();
json data = json::object();
FillJsonScore(data);
Channel::Notifier::Emit(this->id, "score", data);
}
void SimulcastConsumer::UpdateCurrentLayers() void SimulcastConsumer::UpdateCurrentLayers()
{ {
MS_TRACE(); MS_TRACE();
...@@ -746,20 +771,14 @@ namespace RTC ...@@ -746,20 +771,14 @@ namespace RTC
return; return;
} }
bool emitScore{ false };
// Reset the score of our RtpStream to 10 if spatial layer changed. // Reset the score of our RtpStream to 10 if spatial layer changed.
if (this->targetSpatialLayer != this->currentSpatialLayer) if (this->targetSpatialLayer != this->currentSpatialLayer)
{
this->rtpStream->ResetScore(10, false); this->rtpStream->ResetScore(10, false);
// If the new current spatial layer is the preferred one honor the preferred emitScore = true;
// temporal layer.
if (this->targetSpatialLayer == this->preferredSpatialLayer)
{
this->targetTemporalLayer = this->preferredTemporalLayer;
}
// Otherwise, choose the highest temporal layer.
else
{
this->targetTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
} }
this->currentSpatialLayer = this->targetSpatialLayer; this->currentSpatialLayer = this->targetSpatialLayer;
...@@ -774,18 +793,15 @@ namespace RTC ...@@ -774,18 +793,15 @@ namespace RTC
this->currentTemporalLayer, this->currentTemporalLayer,
this->id.c_str()); this->id.c_str());
json data(json::object()); // Emit the layersChange event.
EmitLayersChange();
data["spatialLayer"] = this->currentSpatialLayer;
data["temporalLayer"] = this->currentTemporalLayer;
Channel::Notifier::Emit(this->id, "layerschange", data); // Emit the score event (just if spatial layer changed).
if (emitScore)
// Emit the score event. EmitScore();
EmitScore();
} }
void SimulcastConsumer::RecalculateTargetSpatialLayer() void SimulcastConsumer::RecalculateAndApplyTargetLayers()
{ {
MS_TRACE(); MS_TRACE();
...@@ -836,7 +852,7 @@ namespace RTC ...@@ -836,7 +852,7 @@ namespace RTC
this->encodingContext->preferences.temporalLayer = this->rtpStream->GetTemporalLayers() - 1; this->encodingContext->preferences.temporalLayer = this->rtpStream->GetTemporalLayers() - 1;
} }
// TODO: Emit JS event? EmitLayersChange();
return; return;
} }
...@@ -860,6 +876,29 @@ namespace RTC ...@@ -860,6 +876,29 @@ namespace RTC
RequestKeyFrame(); RequestKeyFrame();
} }
inline void SimulcastConsumer::EmitScore() const
{
MS_TRACE();
json data = json::object();
FillJsonScore(data);
Channel::Notifier::Emit(this->id, "score", data);
}
inline void SimulcastConsumer::EmitLayersChange() const
{
MS_TRACE();
json data = json::object();
data["spatialLayer"] = this->currentSpatialLayer;
data["temporalLayer"] = this->currentTemporalLayer;
Channel::Notifier::Emit(this->id, "layerschange", data);
}
inline RTC::RtpStream* SimulcastConsumer::GetProducerCurrentRtpStream() const inline RTC::RtpStream* SimulcastConsumer::GetProducerCurrentRtpStream() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -887,9 +926,13 @@ namespace RTC ...@@ -887,9 +926,13 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// TODO: NO.
if (IsActive()) if (IsActive())
RecalculateTargetSpatialLayer(); {
if (this->bitrateExternallyManaged)
this->listener->OnConsumerNeedBitrateChange(this);
else
RecalculateAndApplyTargetLayers();
}
// Emit the score event. // Emit the score event.
EmitScore(); EmitScore();
......
...@@ -144,7 +144,7 @@ namespace RTC ...@@ -144,7 +144,7 @@ namespace RTC
{ {
case Channel::Request::MethodId::TRANSPORT_DUMP: case Channel::Request::MethodId::TRANSPORT_DUMP:
{ {
json data(json::object()); json data = json::object();
FillJson(data); FillJson(data);
...@@ -155,7 +155,7 @@ namespace RTC ...@@ -155,7 +155,7 @@ namespace RTC
case Channel::Request::MethodId::TRANSPORT_GET_STATS: case Channel::Request::MethodId::TRANSPORT_GET_STATS:
{ {
json data(json::array()); json data = json::array();
FillJsonStats(data); FillJsonStats(data);
...@@ -224,7 +224,7 @@ namespace RTC ...@@ -224,7 +224,7 @@ namespace RTC
this->rtpHeaderExtensionIds.absSendTime = producerRtpHeaderExtensionIds.absSendTime; this->rtpHeaderExtensionIds.absSendTime = producerRtpHeaderExtensionIds.absSendTime;
// Create status response. // Create status response.
json data(json::object()); json data = json::object();
data["type"] = RTC::RtpParameters::GetTypeString(producer->GetType()); data["type"] = RTC::RtpParameters::GetTypeString(producer->GetType());
...@@ -326,7 +326,7 @@ namespace RTC ...@@ -326,7 +326,7 @@ namespace RTC
"Consumer created [consumerId:%s, producerId:%s]", consumerId.c_str(), producerId.c_str()); "Consumer created [consumerId:%s, producerId:%s]", consumerId.c_str(), producerId.c_str());
// Create status response. // Create status response.
json data(json::object()); json data = json::object();
data["paused"] = consumer->IsPaused(); data["paused"] = consumer->IsPaused();
data["producerPaused"] = consumer->IsProducerPaused(); data["producerPaused"] = consumer->IsProducerPaused();
......
...@@ -590,7 +590,7 @@ namespace RTC ...@@ -590,7 +590,7 @@ namespace RTC
} }
// Tell the caller about the selected local DTLS role. // Tell the caller about the selected local DTLS role.
json data(json::object()); json data = json::object();
switch (this->dtlsRole) switch (this->dtlsRole)
{ {
...@@ -645,7 +645,7 @@ namespace RTC ...@@ -645,7 +645,7 @@ namespace RTC
MS_DEBUG_DEV("WebRtcTransport ICE usernameFragment and password changed [id:%s]", this->id); MS_DEBUG_DEV("WebRtcTransport ICE usernameFragment and password changed [id:%s]", this->id);
// Reply with the updated ICE local parameters. // Reply with the updated ICE local parameters.
json data(json::object()); json data = json::object();
data["iceParameters"] = json::object(); data["iceParameters"] = json::object();
auto jsonIceParametersIt = data.find("iceParameters"); auto jsonIceParametersIt = data.find("iceParameters");
...@@ -1233,7 +1233,7 @@ namespace RTC ...@@ -1233,7 +1233,7 @@ namespace RTC
MS_DEBUG_TAG(ice, "ICE elected tuple"); MS_DEBUG_TAG(ice, "ICE elected tuple");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
this->iceSelectedTuple->FillJson(data["iceSelectedTuple"]); this->iceSelectedTuple->FillJson(data["iceSelectedTuple"]);
...@@ -1247,7 +1247,7 @@ namespace RTC ...@@ -1247,7 +1247,7 @@ namespace RTC
MS_DEBUG_TAG(ice, "ICE connected"); MS_DEBUG_TAG(ice, "ICE connected");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["iceState"] = "connected"; data["iceState"] = "connected";
...@@ -1264,7 +1264,7 @@ namespace RTC ...@@ -1264,7 +1264,7 @@ namespace RTC
MS_DEBUG_TAG(ice, "ICE completed"); MS_DEBUG_TAG(ice, "ICE completed");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["iceState"] = "completed"; data["iceState"] = "completed";
...@@ -1284,7 +1284,7 @@ namespace RTC ...@@ -1284,7 +1284,7 @@ namespace RTC
MS_DEBUG_TAG(ice, "ICE disconnected"); MS_DEBUG_TAG(ice, "ICE disconnected");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["iceState"] = "disconnected"; data["iceState"] = "disconnected";
...@@ -1301,7 +1301,7 @@ namespace RTC ...@@ -1301,7 +1301,7 @@ namespace RTC
MS_DEBUG_TAG(dtls, "DTLS connecting"); MS_DEBUG_TAG(dtls, "DTLS connecting");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["dtlsState"] = "connecting"; data["dtlsState"] = "connecting";
...@@ -1357,7 +1357,7 @@ namespace RTC ...@@ -1357,7 +1357,7 @@ namespace RTC
} }
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["dtlsState"] = "connected"; data["dtlsState"] = "connected";
data["dtlsRemoteCert"] = remoteCert; data["dtlsRemoteCert"] = remoteCert;
...@@ -1375,7 +1375,7 @@ namespace RTC ...@@ -1375,7 +1375,7 @@ namespace RTC
MS_WARN_TAG(dtls, "DTLS failed"); MS_WARN_TAG(dtls, "DTLS failed");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["dtlsState"] = "failed"; data["dtlsState"] = "failed";
...@@ -1389,7 +1389,7 @@ namespace RTC ...@@ -1389,7 +1389,7 @@ namespace RTC
MS_WARN_TAG(dtls, "DTLS remotely closed"); MS_WARN_TAG(dtls, "DTLS remotely closed");
// Notify the Node WebRtcTransport. // Notify the Node WebRtcTransport.
json data(json::object()); json data = json::object();
data["dtlsState"] = "closed"; data["dtlsState"] = "closed";
......
...@@ -129,7 +129,7 @@ inline void Worker::OnChannelRequest(Channel::UnixStreamSocket* /*channel*/, Cha ...@@ -129,7 +129,7 @@ inline void Worker::OnChannelRequest(Channel::UnixStreamSocket* /*channel*/, Cha
{ {
case Channel::Request::MethodId::WORKER_DUMP: case Channel::Request::MethodId::WORKER_DUMP:
{ {
json data(json::object()); json data = json::object();
FillJson(data); FillJson(data);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论