mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-30 07:26:53 +08:00
不指定协议转换时,默认转换hls,rtxp
提高EasyDarwin的rtsp推流兼容性
This commit is contained in:
parent
d41d116a67
commit
ae64bc9bcb
@ -211,10 +211,18 @@ void installWebHook(){
|
|||||||
bool enableHls = true;
|
bool enableHls = true;
|
||||||
bool enableMP4 = false;
|
bool enableMP4 = false;
|
||||||
|
|
||||||
//加try catch目的是兼容之前的hook接口,用户可以不传递enableRtxp、enableHls、enableMP4参数
|
//兼容用户不传递enableRtxp、enableHls、enableMP4参数
|
||||||
try { enableRtxp = obj["enableRtxp"].asBool(); } catch (...) {}
|
if(obj.isMember("enableRtxp")){
|
||||||
try { enableHls = obj["enableHls"].asBool(); } catch (...) {}
|
enableRtxp = obj["enableRtxp"].asBool();
|
||||||
try { enableMP4 = obj["enableMP4"].asBool(); } catch (...) {}
|
}
|
||||||
|
|
||||||
|
if(obj.isMember("enableHls")){
|
||||||
|
enableHls = obj["enableHls"].asBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(obj.isMember("enableMP4")){
|
||||||
|
enableMP4 = obj["enableMP4"].asBool();
|
||||||
|
}
|
||||||
|
|
||||||
invoker(err,enableRtxp,enableHls,enableMP4);
|
invoker(err,enableRtxp,enableHls,enableMP4);
|
||||||
}else{
|
}else{
|
||||||
|
@ -142,6 +142,12 @@ void RtspSession::onRecv(const Buffer::Ptr &pBuf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//字符串是否以xx结尾
|
||||||
|
static inline bool end_of(const string &str, const string &substr){
|
||||||
|
auto pos = str.rfind(substr);
|
||||||
|
return pos != string::npos && pos == str.size() - substr.size();
|
||||||
|
};
|
||||||
|
|
||||||
void RtspSession::onWholeRtspPacket(Parser &parser) {
|
void RtspSession::onWholeRtspPacket(Parser &parser) {
|
||||||
string strCmd = parser.Method(); //提取出请求命令字
|
string strCmd = parser.Method(); //提取出请求命令字
|
||||||
_iCseq = atoi(parser["CSeq"].data());
|
_iCseq = atoi(parser["CSeq"].data());
|
||||||
@ -241,6 +247,13 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) {
|
|||||||
throw SockException(Err_shutdown,err);
|
throw SockException(Err_shutdown,err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto full_url = parser.FullUrl();
|
||||||
|
if(end_of(full_url,".sdp")){
|
||||||
|
//去除.sdp后缀,防止EasyDarwin推流器强制添加.sdp后缀
|
||||||
|
full_url = full_url.substr(0,full_url.length() - 3);
|
||||||
|
_mediaInfo.parse(full_url);
|
||||||
|
}
|
||||||
|
|
||||||
SdpParser sdpParser(parser.Content());
|
SdpParser sdpParser(parser.Content());
|
||||||
_strSession = makeRandStr(12);
|
_strSession = makeRandStr(12);
|
||||||
_aTrackInfo = sdpParser.getAvailableTrack();
|
_aTrackInfo = sdpParser.getAvailableTrack();
|
||||||
|
Loading…
Reference in New Issue
Block a user