Refactor code for #1691

pull/1748/head
winlin 5 years ago
parent 49f88a3326
commit cf48a5594d

@ -2144,31 +2144,15 @@ srs_error_t SrsConfig::global_to_json(SrsJsonObject* obj)
sobj->set(sdir->name, sdir->dumps_arg0_to_integer());
} else if (sdir->name == "rtp_idle_timeout") {
sobj->set(sdir->name, sdir->dumps_arg0_to_integer());
} else if (sdir->name == "ack_timeout") {
sobj->set(sdir->name, sdir->dumps_arg0_to_integer());
} else if (sdir->name == "keepalive_timeout") {
sobj->set(sdir->name, sdir->dumps_arg0_to_integer());
} else if (sdir->name == "audio_enable") {
sobj->set(sdir->name, sdir->dumps_arg0_to_boolean());
} else if (sdir->name == "host") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "serial") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "realm") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "wait_keyframe") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "print_sip_message") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "invite_port_fixed") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "auto_play") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
} else if (sdir->name == "auto_create_channel") {
sobj->set(sdir->name, sdir->dumps_arg0_to_str());
}
}
obj->set(dir->name, sobj);
} else {
@ -3701,11 +3685,8 @@ srs_error_t SrsConfig::check_normal_config()
if (n == "sip") {
for (int j = 0; j < (int)conf->directives.size(); j++) {
string m = conf->at(j)->name;
if (m != "enabled" && m != "listen"
&& m != "ack_timeout" && m != "keepalive_timeout"
&& m != "host" && m != "serial" && m != "realm"
&& m != "print_sip_message" && m != "auto_play"
&& m != "invite_port_fixed") {
if (m != "enabled" && m != "listen" && m != "ack_timeout" && m != "keepalive_timeout"
&& m != "host" && m != "serial" && m != "realm" && m != "auto_play" && m != "invite_port_fixed") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal stream_caster.%s", m.c_str());
}
}
@ -4485,27 +4466,6 @@ bool SrsConfig::get_stream_caster_gb28181_audio_enable(SrsConfDirective* conf)
return SRS_CONF_PERFER_FALSE(conf->arg0());
}
// bool SrsConfig::get_stream_caster_gb28181_print_sip_message(SrsConfDirective* conf)
// {
// static bool DEFAULT = false;
// if (!conf) {
// return DEFAULT;
// }
// conf = conf->get("sip");
// if (!conf) {
// return DEFAULT;
// }
// conf = conf->get("print_sip_message");
// if (!conf || conf->arg0().empty()) {
// return DEFAULT;
// }
// return SRS_CONF_PERFER_FALSE(conf->arg0());
// }
bool SrsConfig::get_stream_caster_gb28181_wait_keyframe(SrsConfDirective* conf)
{
static bool DEFAULT = false;

@ -509,7 +509,6 @@ public:
virtual std::string get_stream_caster_gb28181_host(SrsConfDirective* conf);
virtual std::string get_stream_caster_gb28181_serial(SrsConfDirective* conf);
virtual std::string get_stream_caster_gb28181_realm(SrsConfDirective* conf);
//virtual bool get_stream_caster_gb28181_print_sip_message(SrsConfDirective* conf);
virtual bool get_stream_caster_gb28181_wait_keyframe(SrsConfDirective* conf);
virtual bool get_stream_caster_gb28181_sip_enable(SrsConfDirective* conf);
virtual bool get_stream_caster_gb28181_sip_auto_play(SrsConfDirective* conf);

@ -645,8 +645,7 @@ SrsGb28181Config::SrsGb28181Config(SrsConfDirective* c)
sip_auto_play = _srs_config->get_stream_caster_gb28181_sip_auto_play(c);
sip_ack_timeout = _srs_config->get_stream_caster_gb28181_ack_timeout(c);
sip_keepalive_timeout = _srs_config->get_stream_caster_gb28181_keepalive_timeout(c);
//print_sip_message = _srs_config->get_stream_caster_gb28181_print_sip_message(c);
sip_invite_port_fixed = _srs_config->get_stream_caster_gb28181_sip_invite_port_fixed(c);
sip_invite_port_fixed = _srs_config->get_stream_caster_gb28181_sip_invite_port_fixed(c);
}
SrsGb28181Config::~SrsGb28181Config()

@ -311,7 +311,6 @@ public:
bool sip_enable;
srs_utime_t sip_ack_timeout;
srs_utime_t sip_keepalive_timeout;
bool print_sip_message;
bool sip_auto_play;
bool sip_invite_port_fixed;

@ -120,7 +120,6 @@ srs_error_t SrsHttpParser::parse_message_imp(ISrsReader* reader)
if (buffer->size() > 0) {
ssize_t consumed = http_parser_execute(&parser, &settings, buffer->bytes(), buffer->size());
// The error is set in http_errno.
enum http_errno code;
if ((code = HTTP_PARSER_ERRNO(&parser)) != HPE_OK) {
@ -141,8 +140,7 @@ srs_error_t SrsHttpParser::parse_message_imp(ISrsReader* reader)
}
}
//TODO: fixme 'nparsed' undefined, open info compile error!
srs_info("size=%d, nparsed=%d, consumed=%d", buffer->size(), (int)nparsed, consumed);
srs_info("size=%d, nparsed=%d", buffer->size(), (int)consumed);
// Only consume the header bytes.
buffer->read_slice(consumed);

Loading…
Cancel
Save