From 76e3aaaa298662ab73e2d78925d842b7574a9b2c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 18 May 2018 18:48:17 +0800 Subject: [PATCH] update --- ZLToolKit | 2 +- src/MediaFile/HLSMaker.cpp | 6 +++--- src/Rtsp/Rtsp.cpp | 2 +- src/Rtsp/RtspPlayer.cpp | 2 +- src/Rtsp/RtspSession.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ZLToolKit b/ZLToolKit index dd7e9b69..ee3a9bf9 160000 --- a/ZLToolKit +++ b/ZLToolKit @@ -1 +1 @@ -Subproject commit dd7e9b69e88b512a39314d867c33d8cd935e02f9 +Subproject commit ee3a9bf9fef4b6441af3427a4a81ff4813ed8dc6 diff --git a/src/MediaFile/HLSMaker.cpp b/src/MediaFile/HLSMaker.cpp index 1795f57b..2833f03f 100644 --- a/src/MediaFile/HLSMaker.cpp +++ b/src/MediaFile/HLSMaker.cpp @@ -49,15 +49,15 @@ HLSMaker::HLSMaker(const string& strM3u8File, m_ui32NumSegments = ui32Num; m_ui32SegmentDuration = ui32Duration; - m_strOutputPrefix = strM3u8File.substr(0, strM3u8File.find_last_of('.')); - m_strFileName = m_strOutputPrefix.substr(m_strOutputPrefix.find_last_of('/') + 1); + m_strOutputPrefix = strM3u8File.substr(0, strM3u8File.rfind('.')); + m_strFileName = m_strOutputPrefix.substr(m_strOutputPrefix.rfind('/') + 1); m_ts.init(m_strOutputPrefix + "-0.ts", m_ui32BufSize); } HLSMaker::~HLSMaker() { m_ts.clear(); - string strDir = m_strOutputPrefix.substr(0,m_strOutputPrefix.find_last_of('/')); + string strDir = m_strOutputPrefix.substr(0,m_strOutputPrefix.rfind('/')); File::delete_file(strDir.data()); } diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index bfdaa49e..1e41165c 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -62,7 +62,7 @@ int parserSDP(const string& sdp, RtspTrack Track[2]) { Track[track_cnt].inited = false; Track[track_cnt].PT = atoi(FindField(sdp_mid.c_str(), "a=rtpmap:", " ").c_str()); auto control = string("/") + trim(FindField(sdp_mid.c_str(), "a=control:", "\n")); - Track[track_cnt].controlSuffix = control.substr(1 + control.find_last_of('/')); + Track[track_cnt].controlSuffix = control.substr(1 + control.rfind('/')); if (sdp_mid.find("m=video") != string::npos) { //视频通道 diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index 249c40d3..de3c4458 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -463,7 +463,7 @@ void RtspPlayer::HandleResPAUSE(const Parser& parser, bool bPause) { vector vec = split(strRtpInfo, ","); for(auto &strTrack : vec){ strTrack.append(";"); - auto strControlSuffix = strTrack.substr(1 + strTrack.find_last_of('/'),strTrack.find(';') - strTrack.find_last_of('/') - 1); + auto strControlSuffix = strTrack.substr(1 + strTrack.rfind('/'),strTrack.find(';') - strTrack.rfind('/') - 1); auto strRtpTime = FindField(strTrack.data(), "rtptime=", ";"); auto iIdx = getTrackIndex(strControlSuffix); m_adFistStamp[iIdx] = atoll(strRtpTime.data()); diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 1f9b4166..4b34aa34 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -476,12 +476,12 @@ inline void RtspSession::send_SessionNotFound() { dateHeader().data()); send(m_pcBuf, n); - /*405 Method Not Allowed*/ + /*40 Method Not Allowed*/ } bool RtspSession::handleReq_Setup() { //处理setup命令,该函数可能进入多次 - auto controlSuffix = m_parser.Url().substr(1 + m_parser.Url().find_last_of('/')); + auto controlSuffix = m_parser.Url().substr(1 + m_parser.Url().rfind('/')); int trackIdx = getTrackIndexByControlSuffix(controlSuffix); if (trackIdx == -1) { //未找到相应track