From 9dfa0cc099dcf4b117343f91f4c699d31c21c420 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 21 May 2020 16:19:55 +0800 Subject: [PATCH] RTC: Disable padding --- trunk/conf/full.conf | 5 ----- trunk/src/app/srs_app_config.cpp | 19 +------------------ trunk/src/app/srs_app_config.hpp | 1 - trunk/src/app/srs_app_rtc_conn.cpp | 18 ++---------------- trunk/src/app/srs_app_rtc_conn.hpp | 3 --- 5 files changed, 3 insertions(+), 43 deletions(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index bed1d0073..8310e57c0 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -449,11 +449,6 @@ rtc_server { # @see https://github.com/ossrs/srs/issues/307#issuecomment-612806318 # default: 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 # default: on perf_stat on; diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 7188864f6..ca5e4548f 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3645,7 +3645,7 @@ srs_error_t SrsConfig::check_normal_config() string n = conf->at(i)->name; if (n != "enabled" && n != "listen" && n != "dir" && n != "candidate" && n != "ecdsa" && 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") { 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()); } -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() { static bool DEFAULT = true; diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 8a68e0e1d..a2dcfa153 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -531,7 +531,6 @@ public: virtual bool get_rtc_server_encrypt(); virtual int get_rtc_server_reuseport(); virtual bool get_rtc_server_merge_nalus(); - virtual int get_rtc_server_padding(); virtual bool get_rtc_server_perf_stat(); virtual int get_rtc_server_queue_length(); virtual bool get_rtc_server_black_hole(); diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 918b585d4..916ba9a72 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -494,8 +494,6 @@ SrsRtcPlayer::SrsRtcPlayer(SrsRtcSession* s, int parent_cid) session_ = s; - max_padding = 0; - audio_timestamp = 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; audio_payload_type = a_pt; - max_padding = _srs_config->get_rtc_server_padding(); // TODO: FIXME: Support reload. 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", - video_ssrc, video_payload_type, audio_ssrc, audio_payload_type, max_padding, nack_enabled_); + 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, nack_enabled_); 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) { 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); // TODO: FIXME: Padding audio to the max payload in RTP packets. - if (max_padding > 0) { - } // TODO: FIXME: Why 960? Need Refactoring? audio_timestamp += 960; diff --git a/trunk/src/app/srs_app_rtc_conn.hpp b/trunk/src/app/srs_app_rtc_conn.hpp index 3ad21c175..ece428911 100644 --- a/trunk/src/app/srs_app_rtc_conn.hpp +++ b/trunk/src/app/srs_app_rtc_conn.hpp @@ -207,8 +207,6 @@ private: // Simulators. int nn_simulate_nack_drop; private: - // For merged-write and GSO. - int max_padding; // For merged-write messages. int mw_msgs; 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); // interface ISrsReloadHandler 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_realtime(std::string vhost); public: