diff --git a/src/Common/config.h b/src/Common/config.h index 14c57815..78adbea5 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -57,7 +57,7 @@ bool loadIniConfig(const char *ini_path = nullptr); #define CLEAR_ARR(arr) for(auto &item : arr){ item = 0;} #endif //CLEAR_ARR -#define SERVER_NAME "ZLMediaKit-4.0" +#define SERVER_NAME "ZLMediaKit-4.0(build in " __DATE__ " " __TIME__ ")" #define VHOST_KEY "vhost" #define HTTP_SCHEMA "http" #define RTSP_SCHEMA "rtsp" diff --git a/src/Http/HttpClient.cpp b/src/Http/HttpClient.cpp index c7483b33..16551796 100644 --- a/src/Http/HttpClient.cpp +++ b/src/Http/HttpClient.cpp @@ -71,7 +71,7 @@ void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) { host = FindField(host.data(), NULL, ":"); } _header.emplace("Host", host); - _header.emplace("Tools", "ZLMediaKit"); + _header.emplace("Tools", SERVER_NAME); _header.emplace("Connection", "keep-alive"); _header.emplace("Accept", "*/*"); _header.emplace("Accept-Language", "zh-CN,zh;q=0.8"); diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index a6a886d1..fb59dc91 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -398,7 +398,6 @@ static const string kContentType = "Content-Type"; static const string kContentLength = "Content-Length"; static const string kAccessControlAllowOrigin = "Access-Control-Allow-Origin"; static const string kAccessControlAllowCredentials = "Access-Control-Allow-Credentials"; -static const string kServerName = SERVER_NAME; void HttpSession::sendResponse(const char *pcStatus, bool bClose, @@ -426,7 +425,7 @@ void HttpSession::sendResponse(const char *pcStatus, HttpSession::KeyValue &headerOut = const_cast(header); headerOut.emplace(kDate, dateStr()); - headerOut.emplace(kServer, kServerName); + headerOut.emplace(kServer, SERVER_NAME); headerOut.emplace(kConnection, bClose ? "close" : "keep-alive"); if(!bClose){ string keepAliveString = "timeout="; diff --git a/src/Rtmp/Rtmp.h b/src/Rtmp/Rtmp.h index 8607fa62..74aaf91b 100644 --- a/src/Rtmp/Rtmp.h +++ b/src/Rtmp/Rtmp.h @@ -325,7 +325,7 @@ public: const map &header = map()){ _metadata.set("duration", dur_sec); _metadata.set("fileSize", 0); - _metadata.set("server","ZLMediaKit"); + _metadata.set("server",SERVER_NAME); for (auto &pr : header){ _metadata.set(pr.first, pr.second); } diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index d6415231..716913ea 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -108,8 +108,7 @@ string SdpTrack::toString() const { _printer << "t=" << _t << "\r\n"; } - _printer << "s=RTSP Session, streamed by the ZLMediaKit\r\n"; - _printer << "i=ZLMediaKit Live Stream\r\n"; + _printer << "s=Streamed by " << SERVER_NAME << "\r\n"; getAttrSdp(_attr,_printer); } break; diff --git a/src/Rtsp/Rtsp.h b/src/Rtsp/Rtsp.h index c428f2e4..48204939 100644 --- a/src/Rtsp/Rtsp.h +++ b/src/Rtsp/Rtsp.h @@ -258,17 +258,17 @@ public: _printer << pr.first << "=" << pr.second << "\r\n"; } } else { - _printer << "o=- 1383190487994921 1 IN IP4 0.0.0.0\r\n"; - _printer << "s=RTSP Session, streamed by the ZLMediaKit\r\n"; - _printer << "i=ZLMediaKit Live Stream\r\n"; + _printer << "o=- 0 0 IN IP4 0.0.0.0\r\n"; + _printer << "s=Streamed by " << SERVER_NAME << "\r\n"; _printer << "c=IN IP4 0.0.0.0\r\n"; _printer << "t=0 0\r\n"; } if(dur_sec <= 0){ + //直播 _printer << "a=range:npt=now-\r\n"; }else{ - //点播情况下,vlc不支持支持npt=now-xxx, 但是貌似echo show只支持npt=now-xxx ? + //点播 _printer << "a=range:npt=0-" << dur_sec << "\r\n"; } _printer << "a=control:*\r\n"; diff --git a/src/Rtsp/RtspMediaSource.h b/src/Rtsp/RtspMediaSource.h index d191cad5..32386835 100644 --- a/src/Rtsp/RtspMediaSource.h +++ b/src/Rtsp/RtspMediaSource.h @@ -133,7 +133,7 @@ public: case 1: return tracks[0]->_time_stamp; default: - return MAX(tracks[0]->_time_stamp, tracks[1]->_time_stamp); + return MIN(tracks[0]->_time_stamp, tracks[1]->_time_stamp); } } diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index 1cbc0eaa..377d8e41 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -668,7 +668,7 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std void RtspPlayer::sendRtspRequest(const string &cmd, const string &url,const StrCaseMap &header_const) { auto header = header_const; header.emplace("CSeq",StrPrinter << _uiCseq++); - header.emplace("User-Agent",SERVER_NAME "(build in " __DATE__ " " __TIME__ ")"); + header.emplace("User-Agent",SERVER_NAME); if(!_strSession.empty()){ header.emplace("Session",_strSession); diff --git a/src/Rtsp/RtspPusher.cpp b/src/Rtsp/RtspPusher.cpp index 7dd6a61f..84afca73 100644 --- a/src/Rtsp/RtspPusher.cpp +++ b/src/Rtsp/RtspPusher.cpp @@ -398,7 +398,7 @@ void RtspPusher::sendRtspRequest(const string &cmd, const string &url, const std void RtspPusher::sendRtspRequest(const string &cmd, const string &url,const StrCaseMap &header_const,const string &sdp ) { auto header = header_const; header.emplace("CSeq",StrPrinter << _uiCseq++); - header.emplace("User-Agent",SERVER_NAME "(build in " __DATE__ " " __TIME__ ")"); + header.emplace("User-Agent",SERVER_NAME); if(!_strSession.empty()){ header.emplace("Session",_strSession); diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 0c2e3f1a..35d023e3 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -795,7 +795,7 @@ void RtspSession::handleReq_Play(const Parser &parser) { rtp_info.pop_back(); sendRtspResponse("200 OK", - {"Range", StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << pMediaSrc->getTimeStamp(TrackInvalid) / 1000.0, + {"Range", StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << pMediaSrc->getTimeStamp(TrackInvalid) / 1000.0 << "-", "RTP-Info",rtp_info }); @@ -1033,7 +1033,7 @@ bool RtspSession::sendRtspResponse(const string &res_code, header.emplace("Session",_strSession); } - header.emplace("Server",SERVER_NAME "(build in " __DATE__ " " __TIME__ ")"); + header.emplace("Server",SERVER_NAME); header.emplace("Date",dateStr()); if(!sdp.empty()){ diff --git a/src/Rtsp/RtspSession.h b/src/Rtsp/RtspSession.h index 3747fda8..99c09f2b 100644 --- a/src/Rtsp/RtspSession.h +++ b/src/Rtsp/RtspSession.h @@ -236,8 +236,6 @@ private: RtcpCounter _aRtcpCnt[2]; //rtcp发送时间,trackid idx 为数组下标 Ticker _aRtcpTicker[2]; - //时间戳修整器 - Stamp _stamp[2]; }; /**