rtsp player trust sdp pt ,ingore other pt compatible hik nvr record

This commit is contained in:
xiongguangjie 2022-07-17 00:26:07 +08:00
parent 7db7d5bec0
commit 3eaf7897a7
4 changed files with 14 additions and 1 deletions

View File

@ -114,6 +114,10 @@ void RtpTrack::setNtpStamp(uint32_t rtp_stamp, uint64_t ntp_stamp_ms) {
} }
} }
void RtpTrack::setPT(uint8_t pt){
_pt = pt;
}
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
void RtpTrackImp::setOnSorted(OnSorted cb) { void RtpTrackImp::setOnSorted(OnSorted cb) {

View File

@ -175,6 +175,7 @@ public:
uint32_t getSSRC() const; uint32_t getSSRC() const;
RtpPacket::Ptr inputRtp(TrackType type, int sample_rate, uint8_t *ptr, size_t len); RtpPacket::Ptr inputRtp(TrackType type, int sample_rate, uint8_t *ptr, size_t len);
void setNtpStamp(uint32_t rtp_stamp, uint64_t ntp_stamp_ms); void setNtpStamp(uint32_t rtp_stamp, uint64_t ntp_stamp_ms);
void setPT(uint8_t pt);
protected: protected:
virtual void onRtpSorted(RtpPacket::Ptr rtp) {} virtual void onRtpSorted(RtpPacket::Ptr rtp) {}
@ -252,6 +253,11 @@ public:
_track[index].setNtpStamp(rtp_stamp, ntp_stamp_ms); _track[index].setNtpStamp(rtp_stamp, ntp_stamp_ms);
} }
void setPT(int index, uint8_t pt){
assert(index < kCount && index >= 0);
_track[index].setPT(pt);
}
void clear() { void clear() {
for (auto &track : _track) { for (auto &track : _track) {
track.clear(); track.clear();

View File

@ -217,7 +217,7 @@ public:
std::string getControlUrl(const std::string &base_url) const; std::string getControlUrl(const std::string &base_url) const;
public: public:
int _pt; int _pt = 0xff;
int _channel; int _channel;
int _samplerate; int _samplerate;
TrackType _type; TrackType _type;

View File

@ -208,6 +208,9 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) {
} }
_rtcp_context.clear(); _rtcp_context.clear();
for (auto &track : _sdp_track) { for (auto &track : _sdp_track) {
if(track->_pt != 0xff){
setPT(_rtcp_context.size(),track->_pt);
}
_rtcp_context.emplace_back(std::make_shared<RtcpContextForRecv>()); _rtcp_context.emplace_back(std::make_shared<RtcpContextForRecv>());
} }
sendSetup(0); sendSetup(0);