Merge pull request #6 from lyg1949/lyg1949-patch-1

修复点播rtmp时多出一个后缀名的bug
This commit is contained in:
lyg1949 2020-07-15 14:17:51 +08:00 committed by GitHub
commit 09cce4522d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -380,7 +380,12 @@ string RtmpSession::getStreamId(const string &str){
//vlc和ffplay在播放 rtmp://127.0.0.1/record/0.mp4时
//传过来的url会是rtmp://127.0.0.1/record/mp4:0,
//我们在这里还原成0.mp4
stream_id = stream_id.substr(pos + 1) + "." + stream_id.substr(0,pos);
//实际使用时发现vlcmpv等会传过来rtmp://127.0.0.1/record/mp4:0.mp4,这里做个判断
auto ext = stream_id.substr(0,pos);
stream_id = stream_id.substr(pos + 1);
if(stream_id.find(ext) == string::npos){
stream_id = stream_id + "." + ext;
}
}
if(params.empty()){