mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-04 01:37:33 +08:00
全面整理转协议相关配置文件
This commit is contained in:
@@ -24,7 +24,9 @@ public:
|
||||
RtmpMediaSourceMuxer(const std::string &vhost,
|
||||
const std::string &strApp,
|
||||
const std::string &strId,
|
||||
const TitleMeta::Ptr &title = nullptr) : RtmpMuxer(title){
|
||||
const ProtocolOption &option,
|
||||
const TitleMeta::Ptr &title = nullptr) : RtmpMuxer(title) {
|
||||
_option = option;
|
||||
_media_src = std::make_shared<RtmpMediaSource>(vhost, strApp, strId);
|
||||
getRtmpRing()->setDelegate(_media_src);
|
||||
}
|
||||
@@ -50,35 +52,33 @@ public:
|
||||
}
|
||||
|
||||
void onReaderChanged(MediaSource &sender, int size) override {
|
||||
GET_CONFIG(bool, rtmp_demand, General::kRtmpDemand);
|
||||
_enabled = rtmp_demand ? size : true;
|
||||
if (!size && rtmp_demand) {
|
||||
_enabled = _option.rtmp_demand ? size : true;
|
||||
if (!size && _option.rtmp_demand) {
|
||||
_clear_cache = true;
|
||||
}
|
||||
MediaSourceEventInterceptor::onReaderChanged(sender, size);
|
||||
}
|
||||
|
||||
bool inputFrame(const Frame::Ptr &frame) override {
|
||||
GET_CONFIG(bool, rtmp_demand, General::kRtmpDemand);
|
||||
if (_clear_cache && rtmp_demand) {
|
||||
if (_clear_cache && _option.rtmp_demand) {
|
||||
_clear_cache = false;
|
||||
_media_src->clearCache();
|
||||
}
|
||||
if (_enabled || !rtmp_demand) {
|
||||
if (_enabled || !_option.rtmp_demand) {
|
||||
return RtmpMuxer::inputFrame(frame);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isEnabled() {
|
||||
GET_CONFIG(bool, rtmp_demand, General::kRtmpDemand);
|
||||
//缓存尚未清空时,还允许触发inputFrame函数,以便及时清空缓存
|
||||
return rtmp_demand ? (_clear_cache ? true : _enabled) : true;
|
||||
return _option.rtmp_demand ? (_clear_cache ? true : _enabled) : true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _enabled = true;
|
||||
bool _clear_cache = false;
|
||||
ProtocolOption _option;
|
||||
RtmpMediaSource::Ptr _media_src;
|
||||
};
|
||||
|
||||
|
||||
@@ -530,12 +530,6 @@ void RtmpSession::onRtmpChunk(RtmpPacket::Ptr packet) {
|
||||
WarnL << "Not a rtmp push!";
|
||||
return;
|
||||
}
|
||||
GET_CONFIG(bool, rtmp_modify_stamp, Rtmp::kModifyStamp);
|
||||
if (rtmp_modify_stamp) {
|
||||
int64_t dts_out;
|
||||
_stamp[chunk_data.type_id % 2].revise(chunk_data.time_stamp, chunk_data.time_stamp, dts_out, dts_out, true);
|
||||
chunk_data.time_stamp = (uint32_t)dts_out;
|
||||
}
|
||||
|
||||
if (!_set_meta_data) {
|
||||
_set_meta_data = true;
|
||||
|
||||
@@ -96,8 +96,6 @@ private:
|
||||
//消耗的总流量
|
||||
uint64_t _total_bytes = 0;
|
||||
std::string _tc_url;
|
||||
//推流时间戳修整器
|
||||
Stamp _stamp[2];
|
||||
//数据接收超时计时器
|
||||
toolkit::Ticker _ticker;
|
||||
MediaInfo _media_info;
|
||||
|
||||
Reference in New Issue
Block a user