mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
添加是否添加静音音频选项
This commit is contained in:
parent
940c3ffbca
commit
dd81a70bed
@ -77,12 +77,15 @@ const string kStreamNoneReaderDelayMS = GENERAL_FIELD"streamNoneReaderDelayMS";
|
||||
const string kMaxStreamWaitTimeMS = GENERAL_FIELD"maxStreamWaitMS";
|
||||
const string kEnableVhost = GENERAL_FIELD"enableVhost";
|
||||
const string kUltraLowDelay = GENERAL_FIELD"ultraLowDelay";
|
||||
const string kAddMuteAudio = GENERAL_FIELD"addMuteAudio";
|
||||
|
||||
onceToken token([](){
|
||||
mINI::Instance()[kFlowThreshold] = 1024;
|
||||
mINI::Instance()[kStreamNoneReaderDelayMS] = 5 * 1000;
|
||||
mINI::Instance()[kMaxStreamWaitTimeMS] = 5 * 1000;
|
||||
mINI::Instance()[kEnableVhost] = 1;
|
||||
mINI::Instance()[kUltraLowDelay] = 1;
|
||||
mINI::Instance()[kAddMuteAudio] = 1;
|
||||
},nullptr);
|
||||
|
||||
}//namespace General
|
||||
|
@ -177,6 +177,8 @@ extern const string kMaxStreamWaitTimeMS;
|
||||
extern const string kEnableVhost;
|
||||
//超低延时模式,默认打开,打开后会降低延时但是转发性能会稍差
|
||||
extern const string kUltraLowDelay;
|
||||
//拉流代理时是否添加静音音频
|
||||
extern const string kAddMuteAudio;
|
||||
}//namespace General
|
||||
|
||||
|
||||
|
@ -244,13 +244,16 @@ void PlayerProxy::onPlaySuccess() {
|
||||
videoTrack->addDelegate(_mediaMuxer);
|
||||
}
|
||||
|
||||
//是否添加静音音频
|
||||
GET_CONFIG(bool,addMuteAudio,General::kAddMuteAudio);
|
||||
|
||||
auto audioTrack = getTrack(TrackAudio, false);
|
||||
if(audioTrack){
|
||||
//添加音频
|
||||
_mediaMuxer->addTrack(audioTrack);
|
||||
//音频数据写入_mediaMuxer
|
||||
audioTrack->addDelegate(_mediaMuxer);
|
||||
}else if(videoTrack){
|
||||
}else if(addMuteAudio && videoTrack){
|
||||
//没有音频信息,产生一个静音音频
|
||||
MuteAudioMaker::Ptr audioMaker = std::make_shared<MuteAudioMaker>();
|
||||
//videoTrack把数据写入MuteAudioMaker
|
||||
|
Loading…
Reference in New Issue
Block a user