1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Remove some global elements for debugging. 3.0.152

This commit is contained in:
winlin 2020-10-31 17:53:00 +08:00
parent 9f9e3a5d42
commit b348539687
16 changed files with 49 additions and 46 deletions

View file

@ -91,7 +91,7 @@ bool _bandwidth_is_stopped_publish(SrsBandwidthPacket* pkt)
{
return pkt->is_stopped_publish();
}
srs_error_t _srs_expect_bandwidth_packet(SrsRtmpServer* rtmp, _CheckPacketType pfn)
srs_error_t srs_expect_bandwidth_packet(SrsRtmpServer* rtmp, _CheckPacketType pfn)
{
srs_error_t err = srs_success;
@ -241,7 +241,7 @@ srs_error_t SrsBandwidth::play_start(SrsBandwidthSample* sample, SrsKbpsLimit* l
}
}
if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_play)) != srs_success) {
if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_play)) != srs_success) {
return srs_error_wrap(err, "expect bandwidth");
}
@ -304,7 +304,7 @@ srs_error_t SrsBandwidth::play_stop(SrsBandwidthSample* sample, SrsKbpsLimit* /*
}
}
if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_play)) != srs_success) {
if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_play)) != srs_success) {
return srs_error_wrap(err, "expect bandwidth");
}
@ -328,7 +328,7 @@ srs_error_t SrsBandwidth::publish_start(SrsBandwidthSample* sample, SrsKbpsLimit
}
}
if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_publish)) != srs_success) {
if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_publish)) != srs_success) {
return srs_error_wrap(err, "expect packet");
}
@ -388,7 +388,7 @@ srs_error_t SrsBandwidth::publish_stop(SrsBandwidthSample* sample, SrsKbpsLimit*
// we just ignore the packet and send the bandwidth test data.
bool is_flash = (_req->swfUrl != "");
if (!is_flash) {
if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_publish)) != srs_success) {
if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_publish)) != srs_success) {
return srs_error_wrap(err, "expect bandwidth");
}
}
@ -422,7 +422,7 @@ srs_error_t SrsBandwidth::do_final(SrsBandwidthSample& play_sample, SrsBandwidth
bool is_flash = (_req->swfUrl != "");
if (!is_flash) {
// ignore any error.
err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_final);
err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_final);
srs_error_reset(err);
}

View file

@ -53,7 +53,7 @@ using namespace std;
#include <srs_kernel_utility.hpp>
#include <srs_rtmp_stack.hpp>
using namespace _srs_internal;
using namespace srs_internal;
// @global the version to identify the core.
const char* _srs_version = "XCORE-" RTMP_SIG_SRS_SERVER;
@ -88,7 +88,7 @@ bool is_common_space(char ch)
return (ch == ' ' || ch == '\t' || ch == SRS_CR || ch == SRS_LF);
}
namespace _srs_internal
namespace srs_internal
{
SrsConfigBuffer::SrsConfigBuffer()
{
@ -4404,20 +4404,20 @@ int SrsConfig::get_time_jitter(string vhost)
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return _srs_time_jitter_string2int(DEFAULT);
return srs_time_jitter_string2int(DEFAULT);
}
conf = conf->get("play");
if (!conf) {
return _srs_time_jitter_string2int(DEFAULT);
return srs_time_jitter_string2int(DEFAULT);
}
conf = conf->get("time_jitter");
if (!conf || conf->arg0().empty()) {
return _srs_time_jitter_string2int(DEFAULT);
return srs_time_jitter_string2int(DEFAULT);
}
return _srs_time_jitter_string2int(conf->arg0());
return srs_time_jitter_string2int(conf->arg0());
}
bool SrsConfig::get_mix_correct(string vhost)
@ -6585,15 +6585,15 @@ int SrsConfig::get_dvr_time_jitter(string vhost)
SrsConfDirective* conf = get_dvr(vhost);
if (!conf) {
return _srs_time_jitter_string2int(DEFAULT);
return srs_time_jitter_string2int(DEFAULT);
}
conf = conf->get("time_jitter");
if (!conf || conf->arg0().empty()) {
return _srs_time_jitter_string2int(DEFAULT);
return srs_time_jitter_string2int(DEFAULT);
}
return _srs_time_jitter_string2int(conf->arg0());
return srs_time_jitter_string2int(conf->arg0());
}
bool SrsConfig::get_http_api_enabled()

View file

@ -77,7 +77,7 @@ bool srs_vector_actual_equals(const std::vector<T>& a, const std::vector<T>& b)
return true;
}
namespace _srs_internal
namespace srs_internal
{
// The buffer of config content.
class SrsConfigBuffer
@ -228,7 +228,7 @@ public:
// Parse utilities
public:
// Parse config directive from file buffer.
virtual srs_error_t parse(_srs_internal::SrsConfigBuffer* buffer);
virtual srs_error_t parse(srs_internal::SrsConfigBuffer* buffer);
// Marshal the directive to writer.
// @param level, the root is level0, all its directives are level1, and so on.
virtual srs_error_t persistence(SrsFileWriter* writer, int level);
@ -252,13 +252,13 @@ private:
// 1. read a token(directive args and a ret flag),
// 2. initialize the directive by args, args[0] is name, args[1-N] is args of directive,
// 3. if ret flag indicates there are child-directives, read_conf(directive, block) recursively.
virtual srs_error_t parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type);
virtual srs_error_t parse_conf(srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type);
// Read a token from buffer.
// A token, is the directive args and a flag indicates whether has child-directives.
// @param args, the output directive args, the first is the directive name, left is the args.
// @param line_start, the actual start line of directive.
// @return, an error code indicates error or has child-directives.
virtual srs_error_t read_token(_srs_internal::SrsConfigBuffer* buffer, std::vector<std::string>& args, int& line_start);
virtual srs_error_t read_token(srs_internal::SrsConfigBuffer* buffer, std::vector<std::string>& args, int& line_start);
};
// The config service provider.
@ -422,7 +422,7 @@ protected:
// Parse config from the buffer.
// @param buffer, the config buffer, user must delete it.
// @remark, use protected for the utest to override with mock.
virtual srs_error_t parse_buffer(_srs_internal::SrsConfigBuffer* buffer);
virtual srs_error_t parse_buffer(srs_internal::SrsConfigBuffer* buffer);
// global env
public:
// Get the current work directory.

View file

@ -64,7 +64,7 @@ using namespace std;
// the time to cleanup source.
#define SRS_SOURCE_CLEANUP (30 * SRS_UTIME_SECONDS)
int _srs_time_jitter_string2int(std::string time_jitter)
int srs_time_jitter_string2int(std::string time_jitter)
{
if (time_jitter == "full") {
return SrsRtmpJitterAlgorithmFULL;

View file

@ -72,7 +72,7 @@ enum SrsRtmpJitterAlgorithm
SrsRtmpJitterAlgorithmZERO,
SrsRtmpJitterAlgorithmOFF
};
int _srs_time_jitter_string2int(std::string time_jitter);
int srs_time_jitter_string2int(std::string time_jitter);
// Time jitter detect and correct, to ensure the rtmp stream is monotonically.
class SrsRtmpJitter