添加rtp pause接口,目前默认3分钟

This commit is contained in:
monktan
2020-09-27 16:51:35 +08:00
parent 09d2472f6b
commit fbecb7f5f4
3 changed files with 37 additions and 0 deletions

View File

@@ -180,6 +180,15 @@ void RtpProcess::addTrack(const Track::Ptr & track){
}
bool RtpProcess::alive() {
if(_paused) {
if(_pause_rtp_time.elapsedTime()/ 1000 < 180){
return true;
}else {
WarnL << _media_info._streamid << ", pause timeout.";
return false;
}
}
GET_CONFIG(int,timeoutSec,RtpProxy::kTimeoutSec)
if(_last_rtp_time.elapsedTime() / 1000 < timeoutSec){
return true;
@@ -241,6 +250,12 @@ void RtpProcess::setListener(const std::weak_ptr<MediaSourceEvent> &listener){
}
}
void RtpProcess::setRtpPause(bool pause)
{
_paused = pause;
_pause_rtp_time.resetTime();
}
void RtpProcess::emitOnPublish() {
weak_ptr<RtpProcess> weak_self = shared_from_this();
Broadcast::PublishAuthInvoker invoker = [weak_self](const string &err, bool enableHls, bool enableMP4) {