mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-31 00:37:39 +08:00
转协议支持全局关闭音频:#883
This commit is contained in:
parent
b7e6bfb574
commit
7067472a18
@ -61,6 +61,8 @@ mergeWriteMS=0
|
||||
modifyStamp=0
|
||||
#服务器唯一id,用于触发hook时区别是哪台服务器
|
||||
mediaServerId=your_server_id
|
||||
#转协议是否全局开启或关闭音频
|
||||
enable_audio=1
|
||||
|
||||
###### 以下是按需转协议的开关,在测试ZLMediaKit的接收推流性能时,请把下面开关置1
|
||||
###### 如果某种协议你用不到,你可以把以下开关置1以便节省资源(但是还是可以播放,只是第一个播放者体验稍微差点),
|
||||
|
@ -22,6 +22,11 @@ static size_t constexpr kMaxUnreadyFrame = 100;
|
||||
namespace mediakit{
|
||||
|
||||
void MediaSink::addTrack(const Track::Ptr &track_in) {
|
||||
GET_CONFIG(bool, enabel_audio, General::kEnableAudio);
|
||||
if (!enabel_audio && track_in->getTrackType() == TrackAudio) {
|
||||
//音频被全局忽略
|
||||
return;
|
||||
}
|
||||
lock_guard<recursive_mutex> lck(_mtx);
|
||||
if (_all_track_ready) {
|
||||
WarnL << "all track is ready, add this track too late!";
|
||||
|
@ -74,6 +74,7 @@ const string kRtspDemand = GENERAL_FIELD"rtsp_demand";
|
||||
const string kRtmpDemand = GENERAL_FIELD"rtmp_demand";
|
||||
const string kTSDemand = GENERAL_FIELD"ts_demand";
|
||||
const string kFMP4Demand = GENERAL_FIELD"fmp4_demand";
|
||||
const string kEnableAudio = GENERAL_FIELD"enable_audio";
|
||||
|
||||
onceToken token([](){
|
||||
mINI::Instance()[kFlowThreshold] = 1024;
|
||||
@ -92,6 +93,7 @@ onceToken token([](){
|
||||
mINI::Instance()[kRtmpDemand] = 0;
|
||||
mINI::Instance()[kTSDemand] = 0;
|
||||
mINI::Instance()[kFMP4Demand] = 0;
|
||||
mINI::Instance()[kEnableAudio] = 1;
|
||||
|
||||
},nullptr);
|
||||
|
||||
|
@ -187,6 +187,8 @@ extern const string kRtspDemand;
|
||||
extern const string kRtmpDemand;
|
||||
extern const string kTSDemand;
|
||||
extern const string kFMP4Demand;
|
||||
//转协议是否全局开启或忽略音频
|
||||
extern const string kEnableAudio;
|
||||
}//namespace General
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user