RTC: Disable padding

pull/1809/head
winlin 5 years ago
parent f03bf601e4
commit 9dfa0cc099

@ -449,11 +449,6 @@ rtc_server {
# @see https://github.com/ossrs/srs/issues/307#issuecomment-612806318 # @see https://github.com/ossrs/srs/issues/307#issuecomment-612806318
# default: on # default: on
merge_nalus on; merge_nalus on;
# Whether pad first packet for GSO for padding bytes.
# If 0, disable padding for GSO.
# @remark The max padding size is 0x7f(127).
# default: 127
padding 127;
# Whether enable the perf stat at http://localhost:1985/api/v1/perf # Whether enable the perf stat at http://localhost:1985/api/v1/perf
# default: on # default: on
perf_stat on; perf_stat on;

@ -3645,7 +3645,7 @@ srs_error_t SrsConfig::check_normal_config()
string n = conf->at(i)->name; string n = conf->at(i)->name;
if (n != "enabled" && n != "listen" && n != "dir" && n != "candidate" && n != "ecdsa" if (n != "enabled" && n != "listen" && n != "dir" && n != "candidate" && n != "ecdsa"
&& n != "sendmmsg" && n != "encrypt" && n != "reuseport" && n != "merge_nalus" && n != "sendmmsg" && n != "encrypt" && n != "reuseport" && n != "merge_nalus"
&& n != "padding" && n != "perf_stat" && n != "queue_length" && n != "black_hole" && n != "perf_stat" && n != "queue_length" && n != "black_hole"
&& n != "ip_family") { && n != "ip_family") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal rtc_server.%s", n.c_str()); return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal rtc_server.%s", n.c_str());
} }
@ -4868,23 +4868,6 @@ bool SrsConfig::get_rtc_server_merge_nalus()
return SRS_CONF_PERFER_TRUE(conf->arg0()); return SRS_CONF_PERFER_TRUE(conf->arg0());
} }
int SrsConfig::get_rtc_server_padding()
{
static int DEFAULT = 127;
SrsConfDirective* conf = root->get("rtc_server");
if (!conf) {
return DEFAULT;
}
conf = conf->get("padding");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return srs_min(127, ::atoi(conf->arg0().c_str()));
}
bool SrsConfig::get_rtc_server_perf_stat() bool SrsConfig::get_rtc_server_perf_stat()
{ {
static bool DEFAULT = true; static bool DEFAULT = true;

@ -531,7 +531,6 @@ public:
virtual bool get_rtc_server_encrypt(); virtual bool get_rtc_server_encrypt();
virtual int get_rtc_server_reuseport(); virtual int get_rtc_server_reuseport();
virtual bool get_rtc_server_merge_nalus(); virtual bool get_rtc_server_merge_nalus();
virtual int get_rtc_server_padding();
virtual bool get_rtc_server_perf_stat(); virtual bool get_rtc_server_perf_stat();
virtual int get_rtc_server_queue_length(); virtual int get_rtc_server_queue_length();
virtual bool get_rtc_server_black_hole(); virtual bool get_rtc_server_black_hole();

@ -494,8 +494,6 @@ SrsRtcPlayer::SrsRtcPlayer(SrsRtcSession* s, int parent_cid)
session_ = s; session_ = s;
max_padding = 0;
audio_timestamp = 0; audio_timestamp = 0;
audio_sequence = 0; audio_sequence = 0;
@ -533,24 +531,14 @@ srs_error_t SrsRtcPlayer::initialize(const uint32_t& vssrc, const uint32_t& assr
video_payload_type = v_pt; video_payload_type = v_pt;
audio_payload_type = a_pt; audio_payload_type = a_pt;
max_padding = _srs_config->get_rtc_server_padding();
// TODO: FIXME: Support reload. // TODO: FIXME: Support reload.
nack_enabled_ = _srs_config->get_rtc_nack_enabled(session_->req->vhost); nack_enabled_ = _srs_config->get_rtc_nack_enabled(session_->req->vhost);
srs_trace("RTC publisher video(ssrc=%d, pt=%d), audio(ssrc=%d, pt=%d), padding=%d, nack=%d", srs_trace("RTC publisher video(ssrc=%d, pt=%d), audio(ssrc=%d, pt=%d), nack=%d",
video_ssrc, video_payload_type, audio_ssrc, audio_payload_type, max_padding, nack_enabled_); video_ssrc, video_payload_type, audio_ssrc, audio_payload_type, nack_enabled_);
return err; return err;
} }
srs_error_t SrsRtcPlayer::on_reload_rtc_server()
{
max_padding = _srs_config->get_rtc_server_padding();
srs_trace("Reload rtc_server max_padding=%d", max_padding);
return srs_success;
}
srs_error_t SrsRtcPlayer::on_reload_vhost_play(string vhost) srs_error_t SrsRtcPlayer::on_reload_vhost_play(string vhost)
{ {
SrsRequest* req = session_->req; SrsRequest* req = session_->req;
@ -733,8 +721,6 @@ srs_error_t SrsRtcPlayer::messages_to_packets(SrsRtcSource* source, const vector
pkt->header.set_payload_type(audio_payload_type); pkt->header.set_payload_type(audio_payload_type);
// TODO: FIXME: Padding audio to the max payload in RTP packets. // TODO: FIXME: Padding audio to the max payload in RTP packets.
if (max_padding > 0) {
}
// TODO: FIXME: Why 960? Need Refactoring? // TODO: FIXME: Why 960? Need Refactoring?
audio_timestamp += 960; audio_timestamp += 960;

@ -207,8 +207,6 @@ private:
// Simulators. // Simulators.
int nn_simulate_nack_drop; int nn_simulate_nack_drop;
private: private:
// For merged-write and GSO.
int max_padding;
// For merged-write messages. // For merged-write messages.
int mw_msgs; int mw_msgs;
bool realtime; bool realtime;
@ -221,7 +219,6 @@ public:
srs_error_t initialize(const uint32_t& vssrc, const uint32_t& assrc, const uint16_t& v_pt, const uint16_t& a_pt); srs_error_t initialize(const uint32_t& vssrc, const uint32_t& assrc, const uint16_t& v_pt, const uint16_t& a_pt);
// interface ISrsReloadHandler // interface ISrsReloadHandler
public: public:
virtual srs_error_t on_reload_rtc_server();
virtual srs_error_t on_reload_vhost_play(std::string vhost); virtual srs_error_t on_reload_vhost_play(std::string vhost);
virtual srs_error_t on_reload_vhost_realtime(std::string vhost); virtual srs_error_t on_reload_vhost_realtime(std::string vhost);
public: public:

Loading…
Cancel
Save