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

MAke score callbacks/methods also provide previous score

上级 eb1ae595
......@@ -58,7 +58,8 @@ namespace RTC
void ProducerResumed();
virtual void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) = 0;
virtual void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) = 0;
virtual void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) = 0;
virtual void ProducerRtpStreamScore(
RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0;
void ProducerClosed();
virtual void SendRtpPacket(RTC::RtpPacket* packet) = 0;
virtual void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) = 0;
......
......@@ -19,7 +19,7 @@ namespace RTC
void HandleRequest(Channel::Request* request) override;
void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void SendRtpPacket(RTC::RtpPacket* packet) override;
void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) override;
void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) override;
......@@ -39,7 +39,7 @@ namespace RTC
/* Pure virtual methods inherited from RtpStreamSend::Listener. */
public:
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void OnRtpStreamRetransmitRtpPacket(RTC::RtpStreamSend* rtpStream, RTC::RtpPacket* packet) override;
private:
......
......@@ -29,7 +29,7 @@ namespace RTC
virtual void OnProducerNewRtpStream(
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint32_t mappedSsrc) = 0;
virtual void OnProducerRtpStreamScore(
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score) = 0;
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0;
virtual void OnProducerRtpPacketReceived(RTC::Producer* producer, RTC::RtpPacket* packet) = 0;
virtual void OnProducerSendRtcpPacket(RTC::Producer* producer, RTC::RTCP::Packet* packet) = 0;
virtual void OnProducerNeedWorstRemoteFractionLost(
......@@ -88,7 +88,7 @@ namespace RTC
/* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */
public:
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void OnRtpStreamSendRtcpPacket(RTC::RtpStreamRecv* rtpStream, RTC::RTCP::Packet* packet) override;
void OnRtpStreamNeedWorstRemoteFractionLost(
RTC::RtpStreamRecv* rtpStream, uint8_t& worstRemoteFractionLost) override;
......
......@@ -57,7 +57,8 @@ namespace RTC
RTC::Transport* transport,
RTC::Producer* producer,
RTC::RtpStream* rtpStream,
uint8_t score) override;
uint8_t score,
uint8_t previousScore) override;
void OnTransportNewConsumer(
RTC::Transport* transport, RTC::Consumer* consumer, std::string& producerId) override;
void OnTransportConsumerClosed(RTC::Transport* transport, RTC::Consumer* consumer) override;
......
......@@ -26,7 +26,7 @@ namespace RTC
class Listener
{
public:
virtual void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) = 0;
virtual void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0;
};
public:
......
......@@ -21,7 +21,7 @@ namespace RTC
bool IsActive() const override;
void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void SendRtpPacket(RTC::RtpPacket* packet) override;
void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) override;
void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) override;
......@@ -42,7 +42,7 @@ namespace RTC
/* Pure virtual methods inherited from RtpStreamSend::Listener. */
public:
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void OnRtpStreamRetransmitRtpPacket(RTC::RtpStreamSend* rtpStream, RTC::RtpPacket* packet) override;
private:
......
......@@ -22,7 +22,7 @@ namespace RTC
bool IsActive() const override;
void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void SendRtpPacket(RTC::RtpPacket* packet) override;
void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t now) override;
void NeedWorstRemoteFractionLost(uint32_t mappedSsrc, uint8_t& worstRemoteFractionLost) override;
......@@ -48,7 +48,7 @@ namespace RTC
/* Pure virtual methods inherited from RtpStreamSend::Listener. */
public:
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score) override;
void OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void OnRtpStreamRetransmitRtpPacket(RTC::RtpStreamSend* rtpStream, RTC::RtpPacket* packet) override;
private:
......
......@@ -41,7 +41,8 @@ namespace RTC
RTC::Transport* transport,
RTC::Producer* producer,
RTC::RtpStream* rtpStream,
uint8_t score) = 0;
uint8_t score,
uint8_t previousScore) = 0;
virtual void OnTransportProducerRtpPacketReceived(
RTC::Transport* transport, RTC::Producer* producer, RTC::RtpPacket* packet) = 0;
virtual void OnTransportNeedWorstRemoteFractionLost(
......@@ -103,7 +104,7 @@ namespace RTC
void OnProducerNewRtpStream(
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void OnProducerRtpStreamScore(
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score) override;
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
void OnProducerRtpPacketReceived(RTC::Producer* producer, RTC::RtpPacket* packet) override;
void OnProducerSendRtcpPacket(RTC::Producer* producer, RTC::RTCP::Packet* packet) override;
void OnProducerNeedWorstRemoteFractionLost(
......
......@@ -95,7 +95,8 @@ namespace RTC
// Do nothing.
}
void PipeConsumer::ProducerRtpStreamScore(RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/)
void PipeConsumer::ProducerRtpStreamScore(
RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
{
MS_TRACE();
......@@ -388,7 +389,8 @@ namespace RTC
}
}
inline void PipeConsumer::OnRtpStreamScore(RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/)
inline void PipeConsumer::OnRtpStreamScore(
RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
{
MS_TRACE();
......
......@@ -975,12 +975,12 @@ namespace RTC
Channel::Notifier::Emit(this->id, "score", data);
}
inline void Producer::OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score)
inline void Producer::OnRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore)
{
MS_TRACE();
// Notify the listener.
this->listener->OnProducerRtpStreamScore(this, rtpStream, score);
this->listener->OnProducerRtpStreamScore(this, rtpStream, score, previousScore);
// Emit the score event.
EmitScore();
......
......@@ -37,6 +37,7 @@ namespace RTC
{
MS_TRACE();
// TODO: REMOVE
MS_ERROR("remb:%" PRIu64, remb->GetBitrate());
uint64_t now = DepLibUV::GetTime();
......
......@@ -296,6 +296,7 @@ namespace RTC
(!this->remoteRate.ValidEstimate() ||
nowMs - this->firstPacketTimeMs < InitialProbingIntervalMs))
{
#ifdef MS_LOG_DEV
// TODO(holmer): Use a map instead to get correct order?
if (this->totalProbesReceived < MaxProbePackets)
{
......@@ -317,6 +318,7 @@ namespace RTC
sendDeltaMs,
recvDeltaMs);
}
#endif
this->probes.emplace_back(sendTimeMs, arrivalTimeMs, payloadSize);
++this->totalProbesReceived;
......
......@@ -562,7 +562,11 @@ namespace RTC
}
inline void Router::OnTransportProducerRtpStreamScore(
RTC::Transport* /*transport*/, RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score)
RTC::Transport* /*transport*/,
RTC::Producer* producer,
RTC::RtpStream* rtpStream,
uint8_t score,
uint8_t previousScore)
{
MS_TRACE();
......@@ -570,7 +574,7 @@ namespace RTC
for (auto* consumer : consumers)
{
consumer->ProducerRtpStreamScore(rtpStream, score);
consumer->ProducerRtpStreamScore(rtpStream, score, previousScore);
}
}
......
......@@ -122,11 +122,13 @@ namespace RTC
if (this->score != score)
{
auto previousScore = this->score;
this->score = score;
// Notify the listener.
if (notify)
this->listener->OnRtpStreamScore(this, score);
this->listener->OnRtpStreamScore(this, score, previousScore);
}
}
......@@ -250,7 +252,7 @@ namespace RTC
previousScore,
this->score);
this->listener->OnRtpStreamScore(this, this->score);
this->listener->OnRtpStreamScore(this, this->score, previousScore);
}
else
{
......
......@@ -120,7 +120,8 @@ namespace RTC
EmitScore();
}
void SimpleConsumer::ProducerRtpStreamScore(RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/)
void SimpleConsumer::ProducerRtpStreamScore(
RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
{
MS_TRACE();
......@@ -470,7 +471,8 @@ namespace RTC
Channel::Notifier::Emit(this->id, "score", data);
}
inline void SimpleConsumer::OnRtpStreamScore(RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/)
inline void SimpleConsumer::OnRtpStreamScore(
RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
{
MS_TRACE();
......
......@@ -279,7 +279,8 @@ namespace RTC
EmitScore();
}
void SimulcastConsumer::ProducerRtpStreamScore(RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/)
void SimulcastConsumer::ProducerRtpStreamScore(
RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
{
MS_TRACE();
......@@ -881,7 +882,8 @@ namespace RTC
return this->producerRtpStreams.at(this->targetSpatialLayer);
}
inline void SimulcastConsumer::OnRtpStreamScore(RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/)
inline void SimulcastConsumer::OnRtpStreamScore(
RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
{
MS_TRACE();
......
......@@ -830,11 +830,11 @@ namespace RTC
}
inline void Transport::OnProducerRtpStreamScore(
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score)
RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore)
{
MS_TRACE();
this->listener->OnTransportProducerRtpStreamScore(this, producer, rtpStream, score);
this->listener->OnTransportProducerRtpStreamScore(this, producer, rtpStream, score, previousScore);
}
inline void Transport::OnProducerRtpPacketReceived(RTC::Producer* producer, RTC::RtpPacket* packet)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论