mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
Merge pull request #1805 from ZLMediaKit/feature/fix_rtsp_player_pt_error
Feature/fix rtsp player pt error
This commit is contained in:
commit
d703ec29c6
@ -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) {
|
||||
|
@ -175,6 +175,7 @@ public:
|
||||
uint32_t getSSRC() const;
|
||||
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 setPT(uint8_t pt);
|
||||
|
||||
protected:
|
||||
virtual void onRtpSorted(RtpPacket::Ptr rtp) {}
|
||||
@ -252,6 +253,11 @@ public:
|
||||
_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() {
|
||||
for (auto &track : _track) {
|
||||
track.clear();
|
||||
|
@ -212,7 +212,7 @@ void SdpParser::load(const string &sdp) {
|
||||
char codec[16] = {0};
|
||||
|
||||
sscanf(rtpmap.data(), "%d", &pt);
|
||||
if (track._pt != pt) {
|
||||
if (track._pt != pt && track._pt != 0xff) {
|
||||
//pt不匹配
|
||||
it = track._attr.erase(it);
|
||||
continue;
|
||||
@ -237,7 +237,7 @@ void SdpParser::load(const string &sdp) {
|
||||
auto &fmtp = it->second;
|
||||
int pt;
|
||||
sscanf(fmtp.data(), "%d", &pt);
|
||||
if (track._pt != pt) {
|
||||
if (track._pt != pt && track._pt != 0xff) {
|
||||
//pt不匹配
|
||||
it = track._attr.erase(it);
|
||||
continue;
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
std::string getControlUrl(const std::string &base_url) const;
|
||||
|
||||
public:
|
||||
int _pt;
|
||||
int _pt = 0xff;
|
||||
int _channel;
|
||||
int _samplerate;
|
||||
TrackType _type;
|
||||
|
@ -208,6 +208,9 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) {
|
||||
}
|
||||
_rtcp_context.clear();
|
||||
for (auto &track : _sdp_track) {
|
||||
if(track->_pt != 0xff){
|
||||
setPT(_rtcp_context.size(),track->_pt);
|
||||
}
|
||||
_rtcp_context.emplace_back(std::make_shared<RtcpContextForRecv>());
|
||||
}
|
||||
sendSetup(0);
|
||||
|
Loading…
Reference in New Issue
Block a user