Commit 806cf29e by xiongziliang

支持是否修改rtmp时间戳配置 修改对象命名

parent ca885013
...@@ -174,9 +174,11 @@ namespace Rtmp { ...@@ -174,9 +174,11 @@ namespace Rtmp {
#define RTMP_PORT 1935 #define RTMP_PORT 1935
const char kPort[] = RTMP_FIELD"port"; const char kPort[] = RTMP_FIELD"port";
const char kModifyStamp[] = RTMP_FIELD"modifyStamp";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kPort] = RTMP_PORT; mINI::Instance()[kPort] = RTMP_PORT;
mINI::Instance()[kModifyStamp] = true;
},nullptr); },nullptr);
} //namespace RTMP } //namespace RTMP
......
...@@ -181,6 +181,8 @@ extern const char kAuthBasic[]; ...@@ -181,6 +181,8 @@ extern const char kAuthBasic[];
////////////RTMP服务器配置/////////// ////////////RTMP服务器配置///////////
namespace Rtmp { namespace Rtmp {
extern const char kPort[]; extern const char kPort[];
extern const char kModifyStamp[];
} //namespace RTMP } //namespace RTMP
......
...@@ -71,13 +71,13 @@ public: ...@@ -71,13 +71,13 @@ public:
virtual Buffer::Ptr readData() = 0; virtual Buffer::Ptr readData() = 0;
}; };
class HttpBodyString : public HttpBody{ class HttpStringBody : public HttpBody{
public: public:
typedef std::shared_ptr<HttpBodyString> Ptr; typedef std::shared_ptr<HttpStringBody> Ptr;
HttpBodyString(const string &str){ HttpStringBody(const string &str){
_str = str; _str = str;
} }
virtual ~HttpBodyString(){} virtual ~HttpStringBody(){}
uint64_t remainSize() override { uint64_t remainSize() override {
return _str.size(); return _str.size();
...@@ -229,7 +229,7 @@ public: ...@@ -229,7 +229,7 @@ public:
return *this; return *this;
} }
void setBody(const string &body){ void setBody(const string &body){
_body.reset(new HttpBodyString(body)); _body.reset(new HttpStringBody(body));
} }
void setBody(const HttpBody::Ptr &body){ void setBody(const HttpBody::Ptr &body){
_body = body; _body = body;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "RtmpSession.h" #include "RtmpSession.h"
#include "Common/config.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
namespace ZL { namespace ZL {
...@@ -435,7 +436,10 @@ void RtmpSession::onRtmpChunk(RtmpPacket &chunkData) { ...@@ -435,7 +436,10 @@ void RtmpSession::onRtmpChunk(RtmpPacket &chunkData) {
if (!m_pPublisherSrc) { if (!m_pPublisherSrc) {
throw std::runtime_error("Not a rtmp publisher!"); 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<RtmpPacket>(chunkData)); m_pPublisherSrc->onGetMedia(std::make_shared<RtmpPacket>(chunkData));
if(!m_bPublisherSrcRegisted && m_pPublisherSrc->ready()){ if(!m_bPublisherSrcRegisted && m_pPublisherSrc->ready()){
m_bPublisherSrcRegisted = true; m_bPublisherSrcRegisted = true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论