mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine NACK match and miss logs
This commit is contained in:
parent
8860d0ec62
commit
d97c0f5db2
4 changed files with 31 additions and 7 deletions
|
@ -313,6 +313,8 @@ SrsRtcPlayStream::SrsRtcPlayStream(SrsRtcConnection* s, SrsContextId parent_cid)
|
||||||
|
|
||||||
_srs_config->subscribe(this);
|
_srs_config->subscribe(this);
|
||||||
timer_ = new SrsHourGlass(this, 1000 * SRS_UTIME_MILLISECONDS);
|
timer_ = new SrsHourGlass(this, 1000 * SRS_UTIME_MILLISECONDS);
|
||||||
|
|
||||||
|
nack_epp = new SrsErrorPithyPrint();
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRtcPlayStream::~SrsRtcPlayStream()
|
SrsRtcPlayStream::~SrsRtcPlayStream()
|
||||||
|
@ -336,6 +338,8 @@ SrsRtcPlayStream::~SrsRtcPlayStream()
|
||||||
srs_freep(it->second);
|
srs_freep(it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srs_freep(nack_epp);
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcPlayStream::initialize(SrsRequest* req, std::map<uint32_t, SrsRtcTrackDescription*> sub_relations)
|
srs_error_t SrsRtcPlayStream::initialize(SrsRequest* req, std::map<uint32_t, SrsRtcTrackDescription*> sub_relations)
|
||||||
|
@ -731,8 +735,12 @@ srs_error_t SrsRtcPlayStream::on_rtcp_nack(SrsRtcpNack* rtcp)
|
||||||
for (int i = 0; i < (int)resend_pkts.size(); ++i) {
|
for (int i = 0; i < (int)resend_pkts.size(); ++i) {
|
||||||
SrsRtpPacket2* pkt = resend_pkts[i];
|
SrsRtpPacket2* pkt = resend_pkts[i];
|
||||||
info.nn_bytes += pkt->nb_bytes();
|
info.nn_bytes += pkt->nb_bytes();
|
||||||
srs_trace("RTC NACK ARQ seq=%u, ssrc=%u, ts=%u, %d bytes", pkt->header.get_sequence(),
|
|
||||||
pkt->header.get_ssrc(), pkt->header.get_timestamp(), pkt->nb_bytes());
|
uint32_t nn = 0;
|
||||||
|
if (nack_epp->can_print(pkt->header.get_ssrc(), &nn)) {
|
||||||
|
srs_trace("RTC NACK ARQ seq=%u, ssrc=%u, ts=%u, count=%u/%u, %d bytes", pkt->header.get_sequence(),
|
||||||
|
pkt->header.get_ssrc(), pkt->header.get_timestamp(), nn, nack_epp->nn_count, pkt->nb_bytes());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// By default, we send packets by sendmmsg.
|
// By default, we send packets by sendmmsg.
|
||||||
|
|
|
@ -221,6 +221,8 @@ private:
|
||||||
// key: publish_ssrc, value: send track to process rtp/rtcp
|
// key: publish_ssrc, value: send track to process rtp/rtcp
|
||||||
std::map<uint32_t, SrsRtcAudioSendTrack*> audio_tracks_;
|
std::map<uint32_t, SrsRtcAudioSendTrack*> audio_tracks_;
|
||||||
std::map<uint32_t, SrsRtcVideoSendTrack*> video_tracks_;
|
std::map<uint32_t, SrsRtcVideoSendTrack*> video_tracks_;
|
||||||
|
// The pithy print for special stage.
|
||||||
|
SrsErrorPithyPrint* nack_epp;
|
||||||
private:
|
private:
|
||||||
// For merged-write messages.
|
// For merged-write messages.
|
||||||
int mw_msgs;
|
int mw_msgs;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <srs_app_rtc_conn.hpp>
|
#include <srs_app_rtc_conn.hpp>
|
||||||
#include <srs_protocol_utility.hpp>
|
#include <srs_protocol_utility.hpp>
|
||||||
#include <srs_protocol_json.hpp>
|
#include <srs_protocol_json.hpp>
|
||||||
|
#include <srs_app_pithy_print.hpp>
|
||||||
|
|
||||||
#ifdef SRS_FFMPEG_FIT
|
#ifdef SRS_FFMPEG_FIT
|
||||||
#include <srs_app_rtc_codec.hpp>
|
#include <srs_app_rtc_codec.hpp>
|
||||||
|
@ -1813,6 +1814,8 @@ SrsRtcSendTrack::SrsRtcSendTrack(SrsRtcConnection* session, SrsRtcTrackDescripti
|
||||||
} else {
|
} else {
|
||||||
rtp_queue_ = new SrsRtpRingBuffer(1000);
|
rtp_queue_ = new SrsRtpRingBuffer(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nack_epp = new SrsErrorPithyPrint();
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRtcSendTrack::~SrsRtcSendTrack()
|
SrsRtcSendTrack::~SrsRtcSendTrack()
|
||||||
|
@ -1820,6 +1823,7 @@ SrsRtcSendTrack::~SrsRtcSendTrack()
|
||||||
srs_freep(rtp_queue_);
|
srs_freep(rtp_queue_);
|
||||||
srs_freep(track_desc_);
|
srs_freep(track_desc_);
|
||||||
srs_freep(statistic_);
|
srs_freep(statistic_);
|
||||||
|
srs_freep(nack_epp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsRtcSendTrack::has_ssrc(uint32_t ssrc)
|
bool SrsRtcSendTrack::has_ssrc(uint32_t ssrc)
|
||||||
|
@ -1836,12 +1840,18 @@ SrsRtpPacket2* SrsRtcSendTrack::fetch_rtp_packet(uint16_t seq)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For NACK, it sequence must match exactly, or it cause SRTP fail.
|
// For NACK, it sequence must match exactly, or it cause SRTP fail.
|
||||||
if (pkt->header.get_sequence() != seq) {
|
// Return packet only when sequence is equal.
|
||||||
srs_trace("miss match seq=%u, pkt seq=%u", seq, pkt->header.get_sequence());
|
if (pkt->header.get_sequence() == seq) {
|
||||||
return NULL;
|
return pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkt;
|
// Ignore if sequence not match.
|
||||||
|
uint32_t nn = 0;
|
||||||
|
if (nack_epp->can_print(pkt->header.get_ssrc(), &nn)) {
|
||||||
|
srs_trace("RTC NACK miss seq=%u, require_seq=%u, ssrc=%u, ts=%u, count=%u/%u, %d bytes", seq, pkt->header.get_sequence(),
|
||||||
|
pkt->header.get_ssrc(), pkt->header.get_timestamp(), nn, nack_epp->nn_count, pkt->nb_bytes());
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: FIXME: Should refine logs, set tracks in a time.
|
// TODO: FIXME: Should refine logs, set tracks in a time.
|
||||||
|
|
|
@ -55,6 +55,7 @@ class SrsRtpRingBuffer;
|
||||||
class SrsRtpNackForReceiver;
|
class SrsRtpNackForReceiver;
|
||||||
class SrsJsonObject;
|
class SrsJsonObject;
|
||||||
class SrsRtcPlayStreamStatistic;
|
class SrsRtcPlayStreamStatistic;
|
||||||
|
class SrsErrorPithyPrint;
|
||||||
|
|
||||||
class SrsNtp
|
class SrsNtp
|
||||||
{
|
{
|
||||||
|
@ -530,11 +531,14 @@ protected:
|
||||||
// send track description
|
// send track description
|
||||||
SrsRtcTrackDescription* track_desc_;
|
SrsRtcTrackDescription* track_desc_;
|
||||||
SrsRtcTrackStatistic* statistic_;
|
SrsRtcTrackStatistic* statistic_;
|
||||||
|
protected:
|
||||||
// The owner connection for this track.
|
// The owner connection for this track.
|
||||||
SrsRtcConnection* session_;
|
SrsRtcConnection* session_;
|
||||||
// NACK ARQ ring buffer.
|
// NACK ARQ ring buffer.
|
||||||
SrsRtpRingBuffer* rtp_queue_;
|
SrsRtpRingBuffer* rtp_queue_;
|
||||||
|
private:
|
||||||
|
// The pithy print for special stage.
|
||||||
|
SrsErrorPithyPrint* nack_epp;
|
||||||
public:
|
public:
|
||||||
SrsRtcSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc, bool is_audio);
|
SrsRtcSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc, bool is_audio);
|
||||||
virtual ~SrsRtcSendTrack();
|
virtual ~SrsRtcSendTrack();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue