mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine code
This commit is contained in:
parent
a342f460e7
commit
6012ac4eb0
10 changed files with 167 additions and 96 deletions
|
@ -4310,9 +4310,9 @@ int SrsConfig::get_stream_caster_rtp_port_max(SrsConfDirective* conf)
|
|||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
int SrsConfig::get_stream_caster_gb28181_rtp_idle_timeout(SrsConfDirective* conf)
|
||||
srs_utime_t SrsConfig::get_stream_caster_gb28181_rtp_idle_timeout(SrsConfDirective* conf)
|
||||
{
|
||||
static int DEFAULT = 30;
|
||||
static srs_utime_t DEFAULT = 30 * SRS_UTIME_SECONDS;
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4323,7 +4323,7 @@ int SrsConfig::get_stream_caster_gb28181_rtp_idle_timeout(SrsConfDirective* conf
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
return (srs_utime_t)(::atoi(conf->arg0().c_str()) * SRS_UTIME_SECONDS);
|
||||
}
|
||||
|
||||
int SrsConfig::get_stream_caster_gb28181_ack_timeout(SrsConfDirective* conf)
|
||||
|
@ -4349,7 +4349,7 @@ int SrsConfig::get_stream_caster_gb28181_ack_timeout(SrsConfDirective* conf)
|
|||
|
||||
int SrsConfig::get_stream_caster_gb28181_keepalive_timeout(SrsConfDirective* conf)
|
||||
{
|
||||
static int DEFAULT = 30;
|
||||
static int DEFAULT = 120;
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4386,7 +4386,7 @@ string SrsConfig::get_stream_caster_gb28181_host(SrsConfDirective* conf)
|
|||
|
||||
string SrsConfig::get_stream_caster_gb28181_serial(SrsConfDirective* conf)
|
||||
{
|
||||
static string DEFAULT = "";
|
||||
static string DEFAULT = "34020000002000000001";
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4407,7 +4407,7 @@ string SrsConfig::get_stream_caster_gb28181_serial(SrsConfDirective* conf)
|
|||
|
||||
string SrsConfig::get_stream_caster_gb28181_realm(SrsConfDirective* conf)
|
||||
{
|
||||
static string DEFAULT = "";
|
||||
static string DEFAULT = "3402000000";
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4428,7 +4428,7 @@ string SrsConfig::get_stream_caster_gb28181_realm(SrsConfDirective* conf)
|
|||
|
||||
bool SrsConfig::get_stream_caster_gb28181_audio_enable(SrsConfDirective* conf)
|
||||
{
|
||||
static bool DEFAULT = true;
|
||||
static bool DEFAULT = false;
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4481,7 +4481,7 @@ bool SrsConfig::get_stream_caster_gb28181_wait_keyframe(SrsConfDirective* conf)
|
|||
|
||||
bool SrsConfig::get_stream_caster_gb28181_sip_enable(SrsConfDirective* conf)
|
||||
{
|
||||
static bool DEFAULT = false;
|
||||
static bool DEFAULT = true;
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4503,7 +4503,7 @@ bool SrsConfig::get_stream_caster_gb28181_sip_enable(SrsConfDirective* conf)
|
|||
|
||||
bool SrsConfig::get_stream_caster_gb28181_sip_auto_play(SrsConfDirective* conf)
|
||||
{
|
||||
static bool DEFAULT = false;
|
||||
static bool DEFAULT = true;
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4525,7 +4525,7 @@ bool SrsConfig::get_stream_caster_gb28181_sip_auto_play(SrsConfDirective* conf)
|
|||
|
||||
int SrsConfig::get_stream_caster_gb28181_sip_listen(SrsConfDirective* conf)
|
||||
{
|
||||
static int DEFAULT = 0;
|
||||
static int DEFAULT = 5060;
|
||||
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
|
|
@ -500,7 +500,7 @@ public:
|
|||
// Get the max udp port for rtp of stream caster rtsp.
|
||||
virtual int get_stream_caster_rtp_port_max(SrsConfDirective* conf);
|
||||
|
||||
virtual int get_stream_caster_gb28181_rtp_idle_timeout(SrsConfDirective* conf);
|
||||
virtual srs_utime_t get_stream_caster_gb28181_rtp_idle_timeout(SrsConfDirective* conf);
|
||||
virtual int get_stream_caster_gb28181_ack_timeout(SrsConfDirective* conf);
|
||||
virtual int get_stream_caster_gb28181_keepalive_timeout(SrsConfDirective* conf);
|
||||
virtual bool get_stream_caster_gb28181_audio_enable(SrsConfDirective* conf);
|
||||
|
@ -514,7 +514,6 @@ public:
|
|||
virtual int get_stream_caster_gb28181_sip_listen(SrsConfDirective* conf);
|
||||
virtual bool get_stream_caster_gb28181_sip_invite_port_fixed(SrsConfDirective* conf);
|
||||
|
||||
|
||||
// vhost specified section
|
||||
public:
|
||||
// Get the vhost directive by vhost name.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Winlin
|
||||
* Copyright (c) 2013-2020 Lixin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -749,7 +749,7 @@ srs_error_t SrsGb28181RtmpMuxer::do_cycle()
|
|||
}
|
||||
|
||||
srs_utime_t now = srs_get_system_time();
|
||||
srs_utime_t duration = (now - recv_stream_time) / (1000*1000);
|
||||
srs_utime_t duration = now - recv_stream_time;
|
||||
|
||||
SrsGb28181Config config = gb28181_manger->get_gb28181_config();
|
||||
if (duration > config.rtp_idle_timeout){
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Winlin
|
||||
* Copyright (c) 2013-2020 Lixin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -296,7 +296,7 @@ class SrsGb28181Config
|
|||
{
|
||||
public:
|
||||
std::string host;
|
||||
int rtp_idle_timeout;
|
||||
srs_utime_t rtp_idle_timeout;
|
||||
bool audio_enable;
|
||||
bool wait_keyframe;
|
||||
std::string output;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Winlin
|
||||
* Copyright (c) 2013-2020 Lixin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Winlin
|
||||
* Copyright (c) 2013-2020 Lixin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Winlin
|
||||
* Copyright (c) 2013-2020 Lixin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Winlin
|
||||
* Copyright (c) 2013-2020 Lixin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue