diff --git a/src/Common/config.cpp b/src/Common/config.cpp index 89726ee6..16172cbb 100644 --- a/src/Common/config.cpp +++ b/src/Common/config.cpp @@ -174,9 +174,11 @@ namespace Rtmp { #define RTMP_PORT 1935 const char kPort[] = RTMP_FIELD"port"; +const char kModifyStamp[] = RTMP_FIELD"modifyStamp"; onceToken token([](){ mINI::Instance()[kPort] = RTMP_PORT; + mINI::Instance()[kModifyStamp] = true; },nullptr); } //namespace RTMP diff --git a/src/Common/config.h b/src/Common/config.h index 2811f8bb..a2f01c09 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -181,6 +181,8 @@ extern const char kAuthBasic[]; ////////////RTMP服务器配置/////////// namespace Rtmp { extern const char kPort[]; +extern const char kModifyStamp[]; + } //namespace RTMP diff --git a/src/Http/HttpClient.h b/src/Http/HttpClient.h index 918abb17..8a938f5b 100644 --- a/src/Http/HttpClient.h +++ b/src/Http/HttpClient.h @@ -71,13 +71,13 @@ public: virtual Buffer::Ptr readData() = 0; }; -class HttpBodyString : public HttpBody{ +class HttpStringBody : public HttpBody{ public: - typedef std::shared_ptr Ptr; - HttpBodyString(const string &str){ + typedef std::shared_ptr Ptr; + HttpStringBody(const string &str){ _str = str; } - virtual ~HttpBodyString(){} + virtual ~HttpStringBody(){} uint64_t remainSize() override { return _str.size(); @@ -229,7 +229,7 @@ public: return *this; } void setBody(const string &body){ - _body.reset(new HttpBodyString(body)); + _body.reset(new HttpStringBody(body)); } void setBody(const HttpBody::Ptr &body){ _body = body; diff --git a/src/Rtmp/RtmpSession.cpp b/src/Rtmp/RtmpSession.cpp index 6fbff15d..ea4d8e68 100644 --- a/src/Rtmp/RtmpSession.cpp +++ b/src/Rtmp/RtmpSession.cpp @@ -26,6 +26,7 @@ #include "RtmpSession.h" +#include "Common/config.h" #include "Util/onceToken.h" namespace ZL { @@ -435,7 +436,10 @@ void RtmpSession::onRtmpChunk(RtmpPacket &chunkData) { if (!m_pPublisherSrc) { throw std::runtime_error("Not a rtmp publisher!"); } - chunkData.timeStamp = m_stampTicker[chunkData.typeId % 2].elapsedTime(); + GET_CONFIG_AND_REGISTER(bool,rtmp_modify_stamp,Config::Rtmp::kModifyStamp); + if(rtmp_modify_stamp){ + chunkData.timeStamp = m_stampTicker[chunkData.typeId % 2].elapsedTime(); + } m_pPublisherSrc->onGetMedia(std::make_shared(chunkData)); if(!m_bPublisherSrcRegisted && m_pPublisherSrc->ready()){ m_bPublisherSrcRegisted = true;