This commit is contained in:
xiongziliang 2018-05-18 18:48:17 +08:00
parent b02b5c0f28
commit 76e3aaaa29
5 changed files with 8 additions and 8 deletions

@ -1 +1 @@
Subproject commit dd7e9b69e88b512a39314d867c33d8cd935e02f9 Subproject commit ee3a9bf9fef4b6441af3427a4a81ff4813ed8dc6

View File

@ -49,15 +49,15 @@ HLSMaker::HLSMaker(const string& strM3u8File,
m_ui32NumSegments = ui32Num; m_ui32NumSegments = ui32Num;
m_ui32SegmentDuration = ui32Duration; m_ui32SegmentDuration = ui32Duration;
m_strOutputPrefix = strM3u8File.substr(0, strM3u8File.find_last_of('.')); m_strOutputPrefix = strM3u8File.substr(0, strM3u8File.rfind('.'));
m_strFileName = m_strOutputPrefix.substr(m_strOutputPrefix.find_last_of('/') + 1); m_strFileName = m_strOutputPrefix.substr(m_strOutputPrefix.rfind('/') + 1);
m_ts.init(m_strOutputPrefix + "-0.ts", m_ui32BufSize); m_ts.init(m_strOutputPrefix + "-0.ts", m_ui32BufSize);
} }
HLSMaker::~HLSMaker() { HLSMaker::~HLSMaker() {
m_ts.clear(); 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()); File::delete_file(strDir.data());
} }

View File

@ -62,7 +62,7 @@ int parserSDP(const string& sdp, RtspTrack Track[2]) {
Track[track_cnt].inited = false; Track[track_cnt].inited = false;
Track[track_cnt].PT = atoi(FindField(sdp_mid.c_str(), "a=rtpmap:", " ").c_str()); 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")); 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) { if (sdp_mid.find("m=video") != string::npos) {
//视频通道 //视频通道

View File

@ -463,7 +463,7 @@ void RtspPlayer::HandleResPAUSE(const Parser& parser, bool bPause) {
vector<string> vec = split(strRtpInfo, ","); vector<string> vec = split(strRtpInfo, ",");
for(auto &strTrack : vec){ for(auto &strTrack : vec){
strTrack.append(";"); 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 strRtpTime = FindField(strTrack.data(), "rtptime=", ";");
auto iIdx = getTrackIndex(strControlSuffix); auto iIdx = getTrackIndex(strControlSuffix);
m_adFistStamp[iIdx] = atoll(strRtpTime.data()); m_adFistStamp[iIdx] = atoll(strRtpTime.data());

View File

@ -476,12 +476,12 @@ inline void RtspSession::send_SessionNotFound() {
dateHeader().data()); dateHeader().data());
send(m_pcBuf, n); send(m_pcBuf, n);
/*405 Method Not Allowed*/ /*40 Method Not Allowed*/
} }
bool RtspSession::handleReq_Setup() { bool RtspSession::handleReq_Setup() {
//处理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); int trackIdx = getTrackIndexByControlSuffix(controlSuffix);
if (trackIdx == -1) { if (trackIdx == -1) {
//未找到相应track //未找到相应track