From eb12bc73971aa4a87b4734d0b76f3be885dc4ca9 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 09:39:54 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E6=8F=90=E5=8D=87sdp=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/Factory.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Extension/Factory.cpp b/src/Extension/Factory.cpp index aee7de21..9873b0d7 100644 --- a/src/Extension/Factory.cpp +++ b/src/Extension/Factory.cpp @@ -60,9 +60,10 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { } if (strcasecmp(track->_codec.data(), "h264") == 0) { - auto map = Parser::parseArgs(track->_fmtp," ","="); + //a=fmtp:96 packetization-mode=1;profile-level-id=42C01F;sprop-parameter-sets=Z0LAH9oBQBboQAAAAwBAAAAPI8YMqA==,aM48gA== + auto map = Parser::parseArgs(track->_fmtp,";","="); for(auto &pr : map){ - trim(pr.second," ;"); + trim(pr.second); } auto sps_pps = map["sprop-parameter-sets"]; if(sps_pps.empty()){ @@ -77,9 +78,9 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { if (strcasecmp(track->_codec.data(), "h265") == 0) { //a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBdoAKAgC0WNrkky/AIAAADAAgAAAMBlQg=; sprop-pps=RAHA8vA8kAA= - auto map = Parser::parseArgs(track->_fmtp," ","="); + auto map = Parser::parseArgs(track->_fmtp,";","="); for(auto &pr : map){ - trim(pr.second," ;"); + trim(pr.second); } auto vps = decodeBase64(map["sprop-vps"]); auto sps = decodeBase64(map["sprop-sps"]); From e5cb5c56a13a1effa8f535baebe827bb63b4b592 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 09:44:08 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=8F=90=E5=8D=87sdp=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/Factory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Extension/Factory.cpp b/src/Extension/Factory.cpp index 9873b0d7..b81772a8 100644 --- a/src/Extension/Factory.cpp +++ b/src/Extension/Factory.cpp @@ -61,7 +61,7 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { if (strcasecmp(track->_codec.data(), "h264") == 0) { //a=fmtp:96 packetization-mode=1;profile-level-id=42C01F;sprop-parameter-sets=Z0LAH9oBQBboQAAAAwBAAAAPI8YMqA==,aM48gA== - auto map = Parser::parseArgs(track->_fmtp,";","="); + auto map = Parser::parseArgs(FindField(track->_fmtp.data()," ", nullptr),";","="); for(auto &pr : map){ trim(pr.second); } @@ -78,7 +78,7 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { if (strcasecmp(track->_codec.data(), "h265") == 0) { //a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBdoAKAgC0WNrkky/AIAAADAAgAAAMBlQg=; sprop-pps=RAHA8vA8kAA= - auto map = Parser::parseArgs(track->_fmtp,";","="); + auto map = Parser::parseArgs(FindField(track->_fmtp.data()," ", nullptr),";","="); for(auto &pr : map){ trim(pr.second); } From b1c8b24d187c6f2a6796c261ccac67c6dc5f79b1 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 09:45:43 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=8F=90=E5=8D=87sdp=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/H264.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Extension/H264.h b/src/Extension/H264.h index df14031d..394752ec 100644 --- a/src/Extension/H264.h +++ b/src/Extension/H264.h @@ -390,7 +390,7 @@ public: _printer << "m=video 0 RTP/AVP " << playload_type << "\r\n"; _printer << "b=AS:" << bitrate << "\r\n"; _printer << "a=rtpmap:" << playload_type << " H264/" << 90000 << "\r\n"; - _printer << "a=fmtp:" << playload_type << " packetization-mode=1;profile-level-id="; + _printer << "a=fmtp:" << playload_type << " packetization-mode=1; profile-level-id="; char strTemp[100]; uint32_t profile_level_id = 0; @@ -402,7 +402,7 @@ public: memset(strTemp, 0, 100); sprintf(strTemp, "%06X", profile_level_id); _printer << strTemp; - _printer << ";sprop-parameter-sets="; + _printer << "; sprop-parameter-sets="; memset(strTemp, 0, 100); av_base64_encode(strTemp, 100, (uint8_t *) strSPS.data(), strSPS.size()); _printer << strTemp << ","; From ba71bac475bb9c99a9ec470246a103ea45d9c365 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 09:55:59 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=8F=90=E5=8D=87sdp=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/Parser.h | 2 +- src/Extension/Factory.cpp | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Common/Parser.h b/src/Common/Parser.h index bf9854a7..eaa1874d 100644 --- a/src/Common/Parser.h +++ b/src/Common/Parser.h @@ -163,7 +163,7 @@ class Parser { for (string &key_val : arg_vec) { auto key = FindField(key_val.data(), NULL, key_delim); auto val = FindField(key_val.data(), key_delim, NULL); - ret.emplace_force(key,val); + ret.emplace_force(trim(key),trim(val)); } return ret; } diff --git a/src/Extension/Factory.cpp b/src/Extension/Factory.cpp index b81772a8..763ba27c 100644 --- a/src/Extension/Factory.cpp +++ b/src/Extension/Factory.cpp @@ -62,9 +62,6 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { if (strcasecmp(track->_codec.data(), "h264") == 0) { //a=fmtp:96 packetization-mode=1;profile-level-id=42C01F;sprop-parameter-sets=Z0LAH9oBQBboQAAAAwBAAAAPI8YMqA==,aM48gA== auto map = Parser::parseArgs(FindField(track->_fmtp.data()," ", nullptr),";","="); - for(auto &pr : map){ - trim(pr.second); - } auto sps_pps = map["sprop-parameter-sets"]; if(sps_pps.empty()){ return std::make_shared(); @@ -79,9 +76,6 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { if (strcasecmp(track->_codec.data(), "h265") == 0) { //a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBdoAKAgC0WNrkky/AIAAADAAgAAAMBlQg=; sprop-pps=RAHA8vA8kAA= auto map = Parser::parseArgs(FindField(track->_fmtp.data()," ", nullptr),";","="); - for(auto &pr : map){ - trim(pr.second); - } auto vps = decodeBase64(map["sprop-vps"]); auto sps = decodeBase64(map["sprop-sps"]); auto pps = decodeBase64(map["sprop-pps"]); From 201e06dc0b441c9635898e66f9b3a416904e42b3 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 10:19:52 +0800 Subject: [PATCH 05/10] fixed #102 --- src/MediaFile/Stamp.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/MediaFile/Stamp.cpp b/src/MediaFile/Stamp.cpp index f91c9603..faf20e58 100644 --- a/src/MediaFile/Stamp.cpp +++ b/src/MediaFile/Stamp.cpp @@ -61,9 +61,6 @@ void Stamp::revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_ou //时间戳变小了?,那么取上次时间戳 dts_out = _dts_inc; } - }else if(dts_out - _dts_inc > 1000){ - //直播时,不允许时间戳跳跃性增加 - dts_out = _dts_inc; } } From 5efea2d0cc456b8bd13def44798ee95e8c5b3a34 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 10:22:59 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_player.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_player.cpp b/tests/test_player.cpp index 626c3858..8fd33159 100644 --- a/tests/test_player.cpp +++ b/tests/test_player.cpp @@ -101,6 +101,7 @@ int main(int argc, char *argv[]) { #endif + static char *url = argv[1]; //设置退出信号处理函数 signal(SIGINT, [](int) { SDLDisplayerHelper::Instance().shutdown(); }); //设置日志 @@ -140,7 +141,7 @@ int main(int argc, char *argv[]) { decoder.set(); } if(!displayer){ - displayer.set(); + displayer.set(nullptr,url); } if(!merger){ merger.set(); From ec925a64e4541fc265123741baddaf11f167c691 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 12:55:19 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MediaFile/Stamp.cpp | 75 ++++++++++++++++++++----------------- src/MediaFile/Stamp.h | 46 +++++++++++++++++------ src/Rtsp/RtspPlayer.cpp | 83 ++++++++++++++++------------------------- src/Rtsp/RtspPlayer.h | 11 ++---- 4 files changed, 112 insertions(+), 103 deletions(-) diff --git a/src/MediaFile/Stamp.cpp b/src/MediaFile/Stamp.cpp index faf20e58..e053c122 100644 --- a/src/MediaFile/Stamp.cpp +++ b/src/MediaFile/Stamp.cpp @@ -28,51 +28,51 @@ namespace mediakit { -void Stamp::revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_out) { - if(!pts){ - //没有播放时间戳,使其赋值为解码时间戳 +int64_t DeltaStamp::deltaStamp(int64_t stamp) { + if(!_last_stamp){ + //第一次计算时间戳增量,时间戳增量为0 + _last_stamp = stamp; + return 0; + } + + int64_t ret = stamp - _last_stamp; + if(ret >= 0){ + //时间戳增量为正,返回之 + _last_stamp = stamp; + return ret; + } + + //时间戳增量为负,说明时间戳回环了或回退了 + _last_stamp = stamp; + return _playback ? ret : 0; +} + +void DeltaStamp::setPlayBack(bool playback) { + _playback = playback; +} + +void Stamp::revise(int64_t dts, int64_t pts, int64_t &dts_out, int64_t &pts_out) { + if(!dts && !pts){ + //没有时间戳,我们生成时间戳 + pts = dts = _ticker.elapsedTime(); + }else if(!pts){ + //只是没有播放时间戳,使其赋值为解码时间戳 pts = dts; } + //pts和dts的差值 int pts_dts_diff = pts - dts; - if(_first){ - //记录第一次时间戳,后面好计算时间戳增量 - _start_dts = dts; - _first = false; - _ticker.resetTime(); - } - if (!dts) { - //没有解码时间戳,我们生成解码时间戳 - dts = _ticker.elapsedTime(); - } - //相对时间戳 - dts_out = dts - _start_dts; - if(!_playback){ - if(dts_out < _dts_inc){ - //本次相对时间戳竟然小于上次? - if(dts_out < 0 || _dts_inc - dts_out > 0xFFFF){ - //时间戳回环,保证下次相对时间戳与本次相对合理增长 - _start_dts = dts - _dts_inc; - //本次时间戳强制等于上次时间戳 - dts_out = _dts_inc; - }else{ - //时间戳变小了?,那么取上次时间戳 - dts_out = _dts_inc; - } - } - } - - - //保留这次相对时间戳,以便下次对比是否回环或乱序 - _dts_inc = dts_out; + _relativeStamp += deltaStamp(dts); + dts_out = _relativeStamp; //////////////以下是播放时间戳的计算////////////////// if(pts_dts_diff > 200 || pts_dts_diff < -200){ //如果差值大于200毫秒,则认为由于回环导致时间戳错乱了 pts_dts_diff = 0; } + pts_out = dts_out + pts_dts_diff; if(pts_out < 0){ //时间戳不能小于0 @@ -80,8 +80,13 @@ void Stamp::revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_ou } } -void Stamp::setPlayBack(bool playback) { - _playback = playback; +void Stamp::setRelativeStamp(int64_t relativeStamp) { + _relativeStamp = relativeStamp; } +int64_t Stamp::getRelativeStamp() const { + return _relativeStamp; +} + + }//namespace mediakit \ No newline at end of file diff --git a/src/MediaFile/Stamp.h b/src/MediaFile/Stamp.h index 8616f8a7..23a427f3 100644 --- a/src/MediaFile/Stamp.h +++ b/src/MediaFile/Stamp.h @@ -33,18 +33,33 @@ using namespace toolkit; namespace mediakit { -//该类解决时间戳回环、回退问题 -//计算相对时间戳或者产生平滑时间戳 -class Stamp { +class DeltaStamp{ public: - Stamp() = default; - ~Stamp() = default; + DeltaStamp() = default; + ~DeltaStamp() = default; /** - * 设置回放模式,回放模式时间戳可以回退 + * 计算时间戳增量 + * @param stamp 绝对时间戳 + * @return 时间戳增量 + */ + int64_t deltaStamp(int64_t stamp); + + /** + * 设置是否为回放模式,回放模式运行时间戳回退 * @param playback 是否为回放模式 */ void setPlayBack(bool playback = true); +private: + int64_t _last_stamp = 0; + bool _playback = false; +}; +//该类解决时间戳回环、回退问题 +//计算相对时间戳或者产生平滑时间戳 +class Stamp : public DeltaStamp{ +public: + Stamp() = default; + ~Stamp() = default; /** * 修正时间戳 @@ -53,12 +68,21 @@ public: * @param dts_out 输出dts * @param pts_out 输出pts */ - void revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_out); + void revise(int64_t dts, int64_t pts, int64_t &dts_out, int64_t &pts_out); + + /** + * 再设置相对时间戳,用于seek用 + * @param relativeStamp 相对时间戳 + */ + void setRelativeStamp(int64_t relativeStamp); + + /** + * 获取当前相对时间戳 + * @return + */ + int64_t getRelativeStamp() const ; private: - bool _playback = false; - int64_t _start_dts = 0; - int64_t _dts_inc = 0; - bool _first = true; + int64_t _relativeStamp = 0; SmoothTicker _ticker; }; diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index 126135fe..04d7b184 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -68,12 +68,9 @@ void RtspPlayer::teardown(){ CLEAR_ARR(_aui64RtpRecv) CLEAR_ARR(_aui64RtpRecv) CLEAR_ARR(_aui16NowSeq) - CLEAR_ARR(_aiFistStamp); - CLEAR_ARR(_aiNowStamp); - _pPlayTimer.reset(); + _pPlayTimer.reset(); _pRtpTimer.reset(); - _iSeekTo = 0; _uiCseq = 1; _onHandshake = nullptr; } @@ -222,6 +219,16 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) { SdpParser sdpParser(parser.Content()); //解析sdp _aTrackInfo = sdpParser.getAvailableTrack(); + auto title = sdpParser.getTrack(TrackTitle); + bool isPlayback = false; + if(title && title->_duration ){ + isPlayback = true; + } + + for(auto &stamp : _stamp){ + stamp.setPlayBack(isPlayback); + stamp.setRelativeStamp(0); + } if (_aTrackInfo.empty()) { throw std::runtime_error("无有效的Sdp Track"); @@ -386,7 +393,7 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int uiTrackIndex) } //所有setup命令发送完毕 //发送play命令 - pause(false); + sendPause(false, 0,false); } void RtspPlayer::sendOptions() { @@ -403,25 +410,19 @@ void RtspPlayer::sendDescribe() { } -void RtspPlayer::sendPause(bool bPause,uint32_t seekMS){ - if(!bPause){ - //修改时间轴 - int iTimeInc = seekMS - getProgressMilliSecond(); - for(unsigned int i = 0 ;i < _aTrackInfo.size() ;i++){ - _aiFistStamp[i] = _aiNowStamp[i] + iTimeInc; - _aiNowStamp[i] = _aiFistStamp[i]; - } - _iSeekTo = seekMS; - } - +void RtspPlayer::sendPause(bool bPause,uint32_t seekMS,bool range){ //开启或暂停rtsp _onHandshake = std::bind(&RtspPlayer::handleResPAUSE,this, placeholders::_1,bPause); - sendRtspRequest(bPause ? "PAUSE" : "PLAY", - _strContentBase, - {"Range",StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << seekMS / 1000.0 << "-"}); + if(!bPause && range){ + sendRtspRequest(bPause ? "PAUSE" : "PLAY", _strContentBase, + {"Range",StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << seekMS / 1000.0 << "-"}); + } else{ + sendRtspRequest(bPause ? "PAUSE" : "PLAY", _strContentBase); + } + } void RtspPlayer::pause(bool bPause) { - sendPause(bPause, getProgressMilliSecond()); + sendPause(bPause, getProgressMilliSecond(),false); } void RtspPlayer::handleResPAUSE(const Parser& parser, bool bPause) { @@ -430,6 +431,7 @@ void RtspPlayer::handleResPAUSE(const Parser& parser, bool bPause) { return; } if (!bPause) { + uint32_t iSeekTo = 0; //修正时间轴 auto strRange = parser["Range"]; if (strRange.size()) { @@ -437,25 +439,12 @@ void RtspPlayer::handleResPAUSE(const Parser& parser, bool bPause) { if (strStart == "now") { strStart = "0"; } - _iSeekTo = 1000 * atof(strStart.data()); - DebugL << "seekTo(ms):" << _iSeekTo ; - } - auto strRtpInfo = parser["RTP-Info"]; - if (strRtpInfo.size()) { - strRtpInfo.append(","); - vector vec = split(strRtpInfo, ","); - for(auto &strTrack : vec){ - strTrack.append(";"); - auto strControlSuffix = strTrack.substr(1 + strTrack.rfind('/'),strTrack.find(';') - strTrack.rfind('/') - 1); - auto strRtpTime = FindField(strTrack.data(), "rtptime=", ";"); - auto idx = getTrackIndexByControlSuffix(strControlSuffix); - if(idx != -1){ - _aiFistStamp[idx] = _aTrackInfo[idx]->_samplerate>0?atoll(strRtpTime.data()) * 1000 / _aTrackInfo[idx]->_samplerate :1; - _aiNowStamp[idx] = _aiFistStamp[idx]; - DebugL << "rtptime(ms):" << strControlSuffix <<" " << strRtpTime; - } - } + iSeekTo = 1000 * atof(strStart.data()); + DebugL << "seekTo(ms):" << iSeekTo ; } + //设置相对时间戳 + _stamp[0].setRelativeStamp(iSeekTo); + _stamp[1].setRelativeStamp(iSeekTo); onPlayResult_l(SockException(Err_success, "rtsp play success")); } else { _pRtpTimer.reset(); @@ -630,12 +619,11 @@ void RtspPlayer::onRtpSorted(const RtpPacket::Ptr &rtppt, int trackidx){ } _aui64RtpRecv[trackidx] ++; _aui16NowSeq[trackidx] = rtppt->sequence; - _aiNowStamp[trackidx] = rtppt->timeStamp; - if( _aiFistStamp[trackidx] == 0){ - _aiFistStamp[trackidx] = _aiNowStamp[trackidx]; - } - rtppt->timeStamp -= _aiFistStamp[trackidx]; + //计算相对时间戳 + int64_t dts_out; + _stamp[trackidx].revise(rtppt->timeStamp,rtppt->timeStamp,dts_out,dts_out); + rtppt->timeStamp = dts_out; onRecvRTP_l(rtppt,_aTrackInfo[trackidx]); } float RtspPlayer::getPacketLossRate(TrackType type) const{ @@ -653,7 +641,6 @@ float RtspPlayer::getPacketLossRate(TrackType type) const{ return 1.0 - (double)totalRecv / totalSend; } - if(_aui16NowSeq[iTrackIdx] - _aui16FirstSeq[iTrackIdx] + 1 == 0){ return 0; } @@ -661,14 +648,10 @@ float RtspPlayer::getPacketLossRate(TrackType type) const{ } uint32_t RtspPlayer::getProgressMilliSecond() const{ - uint32_t iTime[2] = {0,0}; - for(unsigned int i = 0 ;i < _aTrackInfo.size() ;i++){ - iTime[i] = _aiNowStamp[i] - _aiFistStamp[i]; - } - return _iSeekTo + MAX(iTime[0],iTime[1]); + return MAX(_stamp[0].getRelativeStamp(),_stamp[1].getRelativeStamp()); } void RtspPlayer::seekToMilliSecond(uint32_t ms) { - sendPause(false,ms); + sendPause(false,ms, true); } void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std::initializer_list &header) { diff --git a/src/Rtsp/RtspPlayer.h b/src/Rtsp/RtspPlayer.h index 5977539b..4de652d8 100644 --- a/src/Rtsp/RtspPlayer.h +++ b/src/Rtsp/RtspPlayer.h @@ -40,6 +40,7 @@ #include "Network/TcpClient.h" #include "RtspSplitter.h" #include "RtpReceiver.h" +#include "MediaFile/Stamp.h" using namespace std; using namespace toolkit; @@ -114,7 +115,7 @@ private: //发送SETUP命令 void sendSetup(unsigned int uiTrackIndex); - void sendPause(bool bPause,uint32_t ms); + void sendPause(bool bPause,uint32_t ms, bool range); void sendOptions(); void sendDescribe(); @@ -148,12 +149,8 @@ private: std::shared_ptr _pPlayTimer; std::shared_ptr _pRtpTimer; - //播放进度控制,单位毫秒 - uint32_t _iSeekTo = 0; - - //单位毫秒 - uint32_t _aiFistStamp[2] = {0,0}; - uint32_t _aiNowStamp[2] = {0,0}; + //时间戳 + Stamp _stamp[2]; //rtcp相关 RtcpCounter _aRtcpCnt[2]; //rtcp统计,trackid idx 为数组下标 From 54b2cd008947e108e737432e7319a3acac309991 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 8 Oct 2019 17:22:27 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0ZLToolKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index b7485c4b..2970df35 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit b7485c4b48b277bfaba2ad930cf1f30e2806299c +Subproject commit 2970df35c5c8c48013f91c818845c5c90914ea57 From 67b70ec8bb1c6def0afe974745c9103cbffd3708 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 9 Oct 2019 22:14:41 +0800 Subject: [PATCH 09/10] =?UTF-8?q?android=E6=94=AF=E6=8C=81=E6=9B=B4?= =?UTF-8?q?=E4=BD=8E=E7=89=88=E6=9C=AC=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=85=B3?= =?UTF-8?q?=E9=97=ADvhost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Android/app/build.gradle | 2 +- Android/app/src/main/cpp/native-lib.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Android/app/build.gradle b/Android/app/build.gradle index da3ae89b..56c5646d 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 28 defaultConfig { applicationId "com.zlmediakit.demo" - minSdkVersion 19 + minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName "1.0" diff --git a/Android/app/src/main/cpp/native-lib.cpp b/Android/app/src/main/cpp/native-lib.cpp index 193ebff7..f6a2946c 100644 --- a/Android/app/src/main/cpp/native-lib.cpp +++ b/Android/app/src/main/cpp/native-lib.cpp @@ -174,6 +174,7 @@ JNI_API(jboolean,startDemo,jstring ini_dir){ mINI::Instance()["http.sslport"] = 8443; mINI::Instance()["rtsp.port"] = 8554; mINI::Instance()["rtsp.sslport"] = 8332; + mINI::Instance()["general.enableVhost"] = 0; for(auto &pr : mINI::Instance()){ //替换hook默认地址 replace(pr.second,"https://127.0.0.1/","http://127.0.0.1:8080/"); From b3c53391f4ce1cffae27a38e6129432ed5dd483d Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 9 Oct 2019 22:18:49 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BD=8E=E7=89=88?= =?UTF-8?q?=E6=9C=ACAndroid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Android/app/src/main/java/com/zlmediakit/demo/MainActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android/app/src/main/java/com/zlmediakit/demo/MainActivity.java b/Android/app/src/main/java/com/zlmediakit/demo/MainActivity.java index 97ee8887..05eba135 100644 --- a/Android/app/src/main/java/com/zlmediakit/demo/MainActivity.java +++ b/Android/app/src/main/java/com/zlmediakit/demo/MainActivity.java @@ -38,10 +38,10 @@ public class MainActivity extends AppCompatActivity { if(permissionSuccess){ Toast.makeText(this,"你可以修改配置文件再启动:" + sd_dir + "/zlmediakit.ini" ,Toast.LENGTH_LONG).show(); Toast.makeText(this,"SSL证书请放置在:" + sd_dir + "/zlmediakit.pem" ,Toast.LENGTH_LONG).show(); - ZLMediaKit.startDemo(sd_dir); }else{ Toast.makeText(this,"请给予我权限,否则无法启动测试!" ,Toast.LENGTH_LONG).show(); } + ZLMediaKit.startDemo(sd_dir); } private ZLMediaKit.MediaPlayer _player;