1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +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

@ -145,6 +145,9 @@ For previous versions, please read:
## V3 changes
* v3.0, 2020-10-31, Remove some global elements for debugging. 3.0.152
* v3.0, 2020-10-31, Use global _srs_server for debugging. 3.0.151
* v3.0, 2020-10-31, Refine source cid, track previous one. 3.0.150
* v3.0, 2020-10-25, Add hls.realtime.conf for low-latency HLS. 3.0.149
* v3.0, 2020-10-24, Refine script and startup logs. 3.0.148
* v3.0, 2020-10-23, Allow FFmpeg if exists at /usr/local/bin/ffmpeg. 3.0.147

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

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 151
#define SRS_VERSION3_REVISION 152
#endif

View file

@ -62,7 +62,7 @@ bool _bandwidth_is_finish(SrsBandwidthPacket* pkt)
{
return pkt->is_finish();
}
int _srs_expect_bandwidth_packet(SrsRtmpClient* rtmp, _CheckPacketType pfn)
int srs_expect_bandwidth_packet(SrsRtmpClient* rtmp, _CheckPacketType pfn)
{
int ret = ERROR_SUCCESS;
srs_error_t err = srs_success;
@ -86,7 +86,7 @@ int _srs_expect_bandwidth_packet(SrsRtmpClient* rtmp, _CheckPacketType pfn)
return ret;
}
int _srs_expect_bandwidth_packet2(SrsRtmpClient* rtmp, _CheckPacketType pfn, SrsBandwidthPacket** ppkt)
int srs_expect_bandwidth_packet2(SrsRtmpClient* rtmp, _CheckPacketType pfn, SrsBandwidthPacket** ppkt)
{
int ret = ERROR_SUCCESS;
srs_error_t err = srs_success;
@ -202,7 +202,7 @@ int SrsBandwidthClient::play_start()
int ret = ERROR_SUCCESS;
srs_error_t err = srs_success;
if ((ret = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_start_play)) != ERROR_SUCCESS) {
if ((ret = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_start_play)) != ERROR_SUCCESS) {
return ret;
}
srs_info("BW check recv play begin request.");
@ -234,7 +234,7 @@ int SrsBandwidthClient::play_stop()
int ret = ERROR_SUCCESS;
srs_error_t err = srs_success;
if ((ret = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_play)) != ERROR_SUCCESS) {
if ((ret = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_play)) != ERROR_SUCCESS) {
return ret;
}
srs_info("BW check recv play stop request.");
@ -262,7 +262,7 @@ int SrsBandwidthClient::publish_start(int& duration_ms, int& play_kbps)
if (true) {
SrsBandwidthPacket* pkt = NULL;
if ((ret = _srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_start_publish, &pkt)) != ERROR_SUCCESS) {
if ((ret = srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_start_publish, &pkt)) != ERROR_SUCCESS) {
return ret;
}
SrsAutoFree(SrsBandwidthPacket, pkt);
@ -367,7 +367,7 @@ int SrsBandwidthClient::publish_stop()
}
srs_info("BW client stop publish request.");
if ((ret = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_publish)) != ERROR_SUCCESS) {
if ((ret = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_publish)) != ERROR_SUCCESS) {
return ret;
}
srs_info("BW check recv publish stop request.");
@ -393,7 +393,7 @@ int SrsBandwidthClient::do_final(SrsBandwidthPacket** ppkt)
int ret = ERROR_SUCCESS;
srs_error_t err = srs_success;
if ((ret = _srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_finish, ppkt)) != ERROR_SUCCESS) {
if ((ret = srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_finish, ppkt)) != ERROR_SUCCESS) {
return ret;
}
srs_info("BW check recv finish/report request.");

View file

@ -33,7 +33,7 @@ using namespace std;
#include <srs_kernel_buffer.hpp>
#include <srs_protocol_json.hpp>
using namespace _srs_internal;
using namespace srs_internal;
// AMF0 marker
#define RTMP_AMF0_Number 0x00
@ -1703,7 +1703,7 @@ srs_error_t srs_amf0_write_undefined(SrsBuffer* stream)
return err;
}
namespace _srs_internal
namespace srs_internal
{
srs_error_t srs_amf0_read_utf8(SrsBuffer* stream, string& value)
{

View file

@ -36,7 +36,7 @@ class SrsAmf0StrictArray;
class SrsJsonAny;
// internal objects, user should never use it.
namespace _srs_internal
namespace srs_internal
{
class SrsUnSortedHashtable;
class SrsAmf0ObjectEOF;
@ -335,8 +335,8 @@ public:
class SrsAmf0Object : public SrsAmf0Any
{
private:
_srs_internal::SrsUnSortedHashtable* properties;
_srs_internal::SrsAmf0ObjectEOF* eof;
srs_internal::SrsUnSortedHashtable* properties;
srs_internal::SrsAmf0ObjectEOF* eof;
private:
friend class SrsAmf0Any;
/**
@ -425,8 +425,8 @@ public:
class SrsAmf0EcmaArray : public SrsAmf0Any
{
private:
_srs_internal::SrsUnSortedHashtable* properties;
_srs_internal::SrsAmf0ObjectEOF* eof;
srs_internal::SrsUnSortedHashtable* properties;
srs_internal::SrsAmf0ObjectEOF* eof;
int32_t _count;
private:
friend class SrsAmf0Any;
@ -626,7 +626,7 @@ extern srs_error_t srs_amf0_read_undefined(SrsBuffer* stream);
extern srs_error_t srs_amf0_write_undefined(SrsBuffer* stream);
// internal objects, user should never use it.
namespace _srs_internal
namespace srs_internal
{
/**
* read amf0 string from stream.

View file

@ -34,7 +34,7 @@
#include <srs_kernel_buffer.hpp>
#include <srs_kernel_utility.hpp>
using namespace _srs_internal;
using namespace srs_internal;
// for openssl_HMACsha256
#include <openssl/evp.h>
@ -111,7 +111,7 @@ static int DH_set_length(DH *dh, long length)
#endif
namespace _srs_internal
namespace srs_internal
{
// 68bytes FMS key which is used to sign the sever packet.
uint8_t SrsGenuineFMSKey[] = {

View file

@ -34,7 +34,7 @@ class SrsBuffer;
// For openssl.
#include <openssl/hmac.h>
namespace _srs_internal
namespace srs_internal
{
// The digest key generate size.
#define SRS_OpensslHashSize 512

View file

@ -32,7 +32,7 @@ using namespace std;
#include <srs_core_autofree.hpp>
#include <srs_protocol_json.hpp>
#include <srs_kernel_buffer.hpp>
using namespace _srs_internal;
using namespace srs_internal;
/**
* main scenario to use amf0.

View file

@ -35,7 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _MIN_OK_CONF "listen 1935; "
class MockSrsConfigBuffer : public _srs_internal::SrsConfigBuffer
class MockSrsConfigBuffer : public srs_internal::SrsConfigBuffer
{
public:
MockSrsConfigBuffer(std::string buf);

View file

@ -352,7 +352,7 @@ VOID TEST(ProtocolHandshakeTest, OpensslSha256)
// verify the dh key
VOID TEST(ProtocolHandshakeTest, DHKey)
{
_srs_internal::SrsDH dh;
srs_internal::SrsDH dh;
ASSERT_TRUE(ERROR_SUCCESS == dh.initialize(true));
@ -368,7 +368,7 @@ VOID TEST(ProtocolHandshakeTest, DHKey)
EXPECT_TRUE(srs_bytes_equals(pub_key1, pub_key2, 128));
// another dh
_srs_internal::SrsDH dh0;
srs_internal::SrsDH dh0;
ASSERT_TRUE(ERROR_SUCCESS == dh0.initialize(true));

View file

@ -37,7 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_stream.hpp>
#include <srs_protocol_kbps.hpp>
using namespace _srs_internal;
using namespace srs_internal;
#include <srs_protocol_io.hpp>