修复时间戳相关的bug

This commit is contained in:
xiongziliang 2018-11-07 17:40:37 +08:00
parent bd51a9a313
commit 6c7a4eb037
2 changed files with 5 additions and 12 deletions

View File

@ -385,8 +385,6 @@ bool RtspPlayer::sendDescribe() {
bool RtspPlayer::sendPause(bool bPause,uint32_t seekMS){
if(!bPause){
//修改时间轴
_aNowStampTicker[0].resetTime();
_aNowStampTicker[1].resetTime();
int iTimeInc = seekMS - getProgressMilliSecond();
for(unsigned int i = 0 ;i < _aTrackInfo.size() ;i++){
_aiFistStamp[i] = _aiNowStamp[i] + iTimeInc;
@ -415,8 +413,6 @@ void RtspPlayer::handleResPAUSE(const Parser& parser, bool bPause) {
}
if (!bPause) {
//修正时间轴
_aNowStampTicker[0].resetTime();
_aNowStampTicker[1].resetTime();
auto strRange = parser["Range"];
if (strRange.size()) {
auto strStart = FindField(strRange.data(), "npt=", "-");
@ -581,11 +577,9 @@ void RtspPlayer::onRecvRTP_l(const RtpPacket::Ptr &rtppt, int trackidx){
}
_aui64RtpRecv[trackidx] ++;
_aui16NowSeq[trackidx] = rtppt->sequence;
if (_aNowStampTicker[trackidx].elapsedTime() > 500) {
_aiNowStamp[trackidx] = rtppt->timeStamp;
}
_aiNowStamp[trackidx] = rtppt->timeStamp;
rtppt->timeStamp -= _aiFistStamp[trackidx];
onRecvRTP_l(rtppt,_aTrackInfo[trackidx]);
}
float RtspPlayer::getPacketLossRate(TrackType type) const{
@ -707,7 +701,8 @@ void RtspPlayer::onPlayResult_l(const SockException &ex) {
int RtspPlayer::getTrackIndexByControlSuffix(const string &controlSuffix) const{
for (unsigned int i = 0; i < _aTrackInfo.size(); i++) {
if (_aTrackInfo[i]->_control_surffix == controlSuffix) {
auto pos = _aTrackInfo[i]->_control_surffix.find(controlSuffix);
if (pos == 0) {
return i;
}
}

View File

@ -106,7 +106,6 @@ private:
bool sendRtspRequest(const string &cmd, const string &url ,const StrCaseMap &header = StrCaseMap());
private:
string _strUrl;
SdpAttr _sdpAttr;
vector<SdpTrack::Ptr> _aTrackInfo;
@ -143,7 +142,6 @@ private:
//单位毫秒
uint32_t _aiFistStamp[2] = {0,0};
uint32_t _aiNowStamp[2] = {0,0};
Ticker _aNowStampTicker[2];
};
} /* namespace mediakit */