Commit 806cf29e by xiongziliang

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

parent ca885013
......@@ -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
......
......@@ -181,6 +181,8 @@ extern const char kAuthBasic[];
////////////RTMP服务器配置///////////
namespace Rtmp {
extern const char kPort[];
extern const char kModifyStamp[];
} //namespace RTMP
......
......@@ -71,13 +71,13 @@ public:
virtual Buffer::Ptr readData() = 0;
};
class HttpBodyString : public HttpBody{
class HttpStringBody : public HttpBody{
public:
typedef std::shared_ptr<HttpBodyString> Ptr;
HttpBodyString(const string &str){
typedef std::shared_ptr<HttpStringBody> 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;
......
......@@ -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<RtmpPacket>(chunkData));
if(!m_bPublisherSrcRegisted && m_pPublisherSrc->ready()){
m_bPublisherSrcRegisted = true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论