mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge SRS3.0
This commit is contained in:
commit
8c1eca98b0
23 changed files with 82 additions and 76 deletions
|
@ -201,6 +201,9 @@ For previous versions, please read:
|
||||||
|
|
||||||
## V3 changes
|
## 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-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-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
|
* v3.0, 2020-10-23, Allow FFmpeg if exists at /usr/local/bin/ffmpeg. 3.0.147
|
||||||
|
|
|
@ -91,7 +91,7 @@ bool _bandwidth_is_stopped_publish(SrsBandwidthPacket* pkt)
|
||||||
{
|
{
|
||||||
return pkt->is_stopped_publish();
|
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;
|
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");
|
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");
|
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");
|
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.
|
// we just ignore the packet and send the bandwidth test data.
|
||||||
bool is_flash = (_req->swfUrl != "");
|
bool is_flash = (_req->swfUrl != "");
|
||||||
if (!is_flash) {
|
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");
|
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 != "");
|
bool is_flash = (_req->swfUrl != "");
|
||||||
if (!is_flash) {
|
if (!is_flash) {
|
||||||
// ignore any error.
|
// 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);
|
srs_error_reset(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ using namespace std;
|
||||||
#include <srs_kernel_utility.hpp>
|
#include <srs_kernel_utility.hpp>
|
||||||
#include <srs_rtmp_stack.hpp>
|
#include <srs_rtmp_stack.hpp>
|
||||||
|
|
||||||
using namespace _srs_internal;
|
using namespace srs_internal;
|
||||||
|
|
||||||
// @global the version to identify the core.
|
// @global the version to identify the core.
|
||||||
const char* _srs_version = "XCORE-" RTMP_SIG_SRS_SERVER;
|
const char* _srs_version = "XCORE-" RTMP_SIG_SRS_SERVER;
|
||||||
|
@ -92,7 +92,7 @@ bool is_common_space(char ch)
|
||||||
return (ch == ' ' || ch == '\t' || ch == SRS_CR || ch == SRS_LF);
|
return (ch == ' ' || ch == '\t' || ch == SRS_CR || ch == SRS_LF);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
SrsConfigBuffer::SrsConfigBuffer()
|
SrsConfigBuffer::SrsConfigBuffer()
|
||||||
{
|
{
|
||||||
|
@ -5272,20 +5272,20 @@ int SrsConfig::get_time_jitter(string vhost)
|
||||||
|
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return _srs_time_jitter_string2int(DEFAULT);
|
return srs_time_jitter_string2int(DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("play");
|
conf = conf->get("play");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return _srs_time_jitter_string2int(DEFAULT);
|
return srs_time_jitter_string2int(DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("time_jitter");
|
conf = conf->get("time_jitter");
|
||||||
if (!conf || conf->arg0().empty()) {
|
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)
|
bool SrsConfig::get_mix_correct(string vhost)
|
||||||
|
@ -7505,15 +7505,15 @@ int SrsConfig::get_dvr_time_jitter(string vhost)
|
||||||
SrsConfDirective* conf = get_dvr(vhost);
|
SrsConfDirective* conf = get_dvr(vhost);
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return _srs_time_jitter_string2int(DEFAULT);
|
return srs_time_jitter_string2int(DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("time_jitter");
|
conf = conf->get("time_jitter");
|
||||||
if (!conf || conf->arg0().empty()) {
|
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()
|
bool SrsConfig::get_http_api_enabled()
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool srs_vector_actual_equals(const std::vector<T>& a, const std::vector<T>& b)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
// The buffer of config content.
|
// The buffer of config content.
|
||||||
class SrsConfigBuffer
|
class SrsConfigBuffer
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
// Parse utilities
|
// Parse utilities
|
||||||
public:
|
public:
|
||||||
// Parse config directive from file buffer.
|
// 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.
|
// Marshal the directive to writer.
|
||||||
// @param level, the root is level0, all its directives are level1, and so on.
|
// @param level, the root is level0, all its directives are level1, and so on.
|
||||||
virtual srs_error_t persistence(SrsFileWriter* writer, int level);
|
virtual srs_error_t persistence(SrsFileWriter* writer, int level);
|
||||||
|
@ -253,13 +253,13 @@ private:
|
||||||
// 1. read a token(directive args and a ret flag),
|
// 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,
|
// 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.
|
// 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.
|
// Read a token from buffer.
|
||||||
// A token, is the directive args and a flag indicates whether has child-directives.
|
// 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 args, the output directive args, the first is the directive name, left is the args.
|
||||||
// @param line_start, the actual start line of directive.
|
// @param line_start, the actual start line of directive.
|
||||||
// @return, an error code indicates error or has child-directives.
|
// @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.
|
// The config service provider.
|
||||||
|
@ -425,7 +425,7 @@ protected:
|
||||||
// Parse config from the buffer.
|
// Parse config from the buffer.
|
||||||
// @param buffer, the config buffer, user must delete it.
|
// @param buffer, the config buffer, user must delete it.
|
||||||
// @remark, use protected for the utest to override with mock.
|
// @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
|
// global env
|
||||||
public:
|
public:
|
||||||
// Get the current work directory.
|
// Get the current work directory.
|
||||||
|
|
|
@ -1141,9 +1141,9 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle
|
||||||
|
|
||||||
// trigger edge to fetch from origin.
|
// trigger edge to fetch from origin.
|
||||||
bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost);
|
bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost);
|
||||||
srs_trace("flv: source url=%s, is_edge=%d, source_id=[%d][%s]",
|
srs_trace("flv: source url=%s, is_edge=%d, source_id=%s/%s",
|
||||||
r->get_stream_url().c_str(), vhost_is_edge, ::getpid(), s->source_id().c_str());
|
r->get_stream_url().c_str(), vhost_is_edge, s->source_id().c_str(), s->pre_source_id().c_str());
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -524,8 +524,8 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled_cache = _srs_config->get_gop_cache(req->vhost);
|
bool enabled_cache = _srs_config->get_gop_cache(req->vhost);
|
||||||
srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, source_id=[%d][%s]",
|
srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, source_id=%s/%s",
|
||||||
req->get_stream_url().c_str(), ip.c_str(), enabled_cache, info->edge, ::getpid(), source->source_id().c_str());
|
req->get_stream_url().c_str(), ip.c_str(), enabled_cache, info->edge, source->source_id().c_str(), source->pre_source_id().c_str());
|
||||||
source->set_cache(enabled_cache);
|
source->set_cache(enabled_cache);
|
||||||
|
|
||||||
switch (info->type) {
|
switch (info->type) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ using namespace std;
|
||||||
// the time to cleanup source.
|
// the time to cleanup source.
|
||||||
#define SRS_SOURCE_CLEANUP (30 * SRS_UTIME_SECONDS)
|
#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") {
|
if (time_jitter == "full") {
|
||||||
return SrsRtmpJitterAlgorithmFULL;
|
return SrsRtmpJitterAlgorithmFULL;
|
||||||
|
@ -519,7 +519,7 @@ srs_error_t SrsConsumer::dump_packets(SrsMessageArray* msgs, int& count)
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
if (should_update_source_id) {
|
if (should_update_source_id) {
|
||||||
srs_trace("update source_id=%s[%s]", source->source_id().c_str(), source->source_id().c_str());
|
srs_trace("update source_id=%s/%s", source->source_id().c_str(), source->pre_source_id().c_str());
|
||||||
should_update_source_id = false;
|
should_update_source_id = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2070,13 +2070,10 @@ srs_error_t SrsSource::on_source_id_changed(SrsContextId id)
|
||||||
if (!_source_id.compare(id)) {
|
if (!_source_id.compare(id)) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pre_source_id.empty()) {
|
if (_pre_source_id.empty()) {
|
||||||
_pre_source_id = id;
|
_pre_source_id = id;
|
||||||
} else if (_pre_source_id.compare(_source_id)) {
|
|
||||||
_pre_source_id = _source_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_source_id = id;
|
_source_id = id;
|
||||||
|
|
||||||
// notice all consumer
|
// notice all consumer
|
||||||
|
@ -2559,7 +2556,10 @@ void SrsSource::on_unpublish()
|
||||||
|
|
||||||
_can_publish = true;
|
_can_publish = true;
|
||||||
_source_id = SrsContextId();
|
_source_id = SrsContextId();
|
||||||
|
if (!_source_id.empty()) {
|
||||||
|
_pre_source_id = _source_id;
|
||||||
|
}
|
||||||
|
|
||||||
// notify the handler.
|
// notify the handler.
|
||||||
srs_assert(handler);
|
srs_assert(handler);
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
|
|
|
@ -72,7 +72,7 @@ enum SrsRtmpJitterAlgorithm
|
||||||
SrsRtmpJitterAlgorithmZERO,
|
SrsRtmpJitterAlgorithmZERO,
|
||||||
SrsRtmpJitterAlgorithmOFF
|
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.
|
// Time jitter detect and correct, to ensure the rtmp stream is monotonically.
|
||||||
class SrsRtmpJitter
|
class SrsRtmpJitter
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
#ifndef SRS_CORE_VERSION3_HPP
|
#ifndef SRS_CORE_VERSION3_HPP
|
||||||
#define SRS_CORE_VERSION3_HPP
|
#define SRS_CORE_VERSION3_HPP
|
||||||
|
|
||||||
#define SRS_VERSION3_REVISION 149
|
#define SRS_VERSION3_REVISION 152
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,11 +37,11 @@ using namespace std;
|
||||||
#include <srs_kernel_error.hpp>
|
#include <srs_kernel_error.hpp>
|
||||||
|
|
||||||
// For utest to mock it.
|
// For utest to mock it.
|
||||||
_srs_open_t _srs_open_fn = ::open;
|
srs_open_t _srs_open_fn = ::open;
|
||||||
_srs_write_t _srs_write_fn = ::write;
|
srs_write_t _srs_write_fn = ::write;
|
||||||
_srs_read_t _srs_read_fn = ::read;
|
srs_read_t _srs_read_fn = ::read;
|
||||||
_srs_lseek_t _srs_lseek_fn = ::lseek;
|
srs_lseek_t _srs_lseek_fn = ::lseek;
|
||||||
_srs_close_t _srs_close_fn = ::close;
|
srs_close_t _srs_close_fn = ::close;
|
||||||
|
|
||||||
SrsFileWriter::SrsFileWriter()
|
SrsFileWriter::SrsFileWriter()
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,11 +121,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// For utest to mock it.
|
// For utest to mock it.
|
||||||
typedef int (*_srs_open_t)(const char* path, int oflag, ...);
|
typedef int (*srs_open_t)(const char* path, int oflag, ...);
|
||||||
typedef ssize_t (*_srs_write_t)(int fildes, const void* buf, size_t nbyte);
|
typedef ssize_t (*srs_write_t)(int fildes, const void* buf, size_t nbyte);
|
||||||
typedef ssize_t (*_srs_read_t)(int fildes, void* buf, size_t nbyte);
|
typedef ssize_t (*srs_read_t)(int fildes, void* buf, size_t nbyte);
|
||||||
typedef off_t (*_srs_lseek_t)(int fildes, off_t offset, int whence);
|
typedef off_t (*srs_lseek_t)(int fildes, off_t offset, int whence);
|
||||||
typedef int (*_srs_close_t)(int fildes);
|
typedef int (*srs_close_t)(int fildes);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ srs_utime_t srs_get_system_startup_time()
|
||||||
|
|
||||||
// For utest to mock it.
|
// For utest to mock it.
|
||||||
#ifndef SRS_OSX
|
#ifndef SRS_OSX
|
||||||
_srs_gettimeofday_t _srs_gettimeofday = (_srs_gettimeofday_t)::gettimeofday;
|
srs_gettimeofday_t _srs_gettimeofday = (srs_gettimeofday_t)::gettimeofday;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
srs_utime_t srs_update_system_time()
|
srs_utime_t srs_update_system_time()
|
||||||
|
|
|
@ -174,7 +174,7 @@ extern int srs_chunk_header_c3(int perfer_cid, uint32_t timestamp, char* cache,
|
||||||
#ifdef SRS_OSX
|
#ifdef SRS_OSX
|
||||||
#define _srs_gettimeofday gettimeofday
|
#define _srs_gettimeofday gettimeofday
|
||||||
#else
|
#else
|
||||||
typedef int (*_srs_gettimeofday_t) (struct timeval* tv, struct timezone* tz);
|
typedef int (*srs_gettimeofday_t) (struct timeval* tv, struct timezone* tz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,6 +77,9 @@ SrsConfig* _srs_config = new SrsConfig();
|
||||||
// @global version of srs, which can grep keyword "XCORE"
|
// @global version of srs, which can grep keyword "XCORE"
|
||||||
extern const char* _srs_version;
|
extern const char* _srs_version;
|
||||||
|
|
||||||
|
// @global main SRS server, for debugging
|
||||||
|
SrsServer* _srs_server = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main entrance.
|
* main entrance.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -33,7 +33,7 @@ using namespace std;
|
||||||
#include <srs_kernel_buffer.hpp>
|
#include <srs_kernel_buffer.hpp>
|
||||||
#include <srs_protocol_json.hpp>
|
#include <srs_protocol_json.hpp>
|
||||||
|
|
||||||
using namespace _srs_internal;
|
using namespace srs_internal;
|
||||||
|
|
||||||
// AMF0 marker
|
// AMF0 marker
|
||||||
#define RTMP_AMF0_Number 0x00
|
#define RTMP_AMF0_Number 0x00
|
||||||
|
@ -1703,7 +1703,7 @@ srs_error_t srs_amf0_write_undefined(SrsBuffer* stream)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
srs_error_t srs_amf0_read_utf8(SrsBuffer* stream, string& value)
|
srs_error_t srs_amf0_read_utf8(SrsBuffer* stream, string& value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ class SrsAmf0StrictArray;
|
||||||
class SrsJsonAny;
|
class SrsJsonAny;
|
||||||
|
|
||||||
// internal objects, user should never use it.
|
// internal objects, user should never use it.
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
class SrsUnSortedHashtable;
|
class SrsUnSortedHashtable;
|
||||||
class SrsAmf0ObjectEOF;
|
class SrsAmf0ObjectEOF;
|
||||||
|
@ -335,8 +335,8 @@ public:
|
||||||
class SrsAmf0Object : public SrsAmf0Any
|
class SrsAmf0Object : public SrsAmf0Any
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
_srs_internal::SrsUnSortedHashtable* properties;
|
srs_internal::SrsUnSortedHashtable* properties;
|
||||||
_srs_internal::SrsAmf0ObjectEOF* eof;
|
srs_internal::SrsAmf0ObjectEOF* eof;
|
||||||
private:
|
private:
|
||||||
friend class SrsAmf0Any;
|
friend class SrsAmf0Any;
|
||||||
/**
|
/**
|
||||||
|
@ -425,8 +425,8 @@ public:
|
||||||
class SrsAmf0EcmaArray : public SrsAmf0Any
|
class SrsAmf0EcmaArray : public SrsAmf0Any
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
_srs_internal::SrsUnSortedHashtable* properties;
|
srs_internal::SrsUnSortedHashtable* properties;
|
||||||
_srs_internal::SrsAmf0ObjectEOF* eof;
|
srs_internal::SrsAmf0ObjectEOF* eof;
|
||||||
int32_t _count;
|
int32_t _count;
|
||||||
private:
|
private:
|
||||||
friend class SrsAmf0Any;
|
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);
|
extern srs_error_t srs_amf0_write_undefined(SrsBuffer* stream);
|
||||||
|
|
||||||
// internal objects, user should never use it.
|
// internal objects, user should never use it.
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* read amf0 string from stream.
|
* read amf0 string from stream.
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <srs_kernel_buffer.hpp>
|
#include <srs_kernel_buffer.hpp>
|
||||||
#include <srs_kernel_utility.hpp>
|
#include <srs_kernel_utility.hpp>
|
||||||
|
|
||||||
using namespace _srs_internal;
|
using namespace srs_internal;
|
||||||
|
|
||||||
// for openssl_HMACsha256
|
// for openssl_HMACsha256
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
@ -112,7 +112,7 @@ static int DH_set_length(DH *dh, long length)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
// 68bytes FMS key which is used to sign the sever packet.
|
// 68bytes FMS key which is used to sign the sever packet.
|
||||||
uint8_t SrsGenuineFMSKey[] = {
|
uint8_t SrsGenuineFMSKey[] = {
|
||||||
|
|
|
@ -40,7 +40,7 @@ extern HMAC_CTX *HMAC_CTX_new(void);
|
||||||
extern void HMAC_CTX_free(HMAC_CTX *ctx);
|
extern void HMAC_CTX_free(HMAC_CTX *ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace srs_internal
|
||||||
{
|
{
|
||||||
// The digest key generate size.
|
// The digest key generate size.
|
||||||
#define SRS_OpensslHashSize 512
|
#define SRS_OpensslHashSize 512
|
||||||
|
|
|
@ -32,7 +32,7 @@ using namespace std;
|
||||||
#include <srs_core_autofree.hpp>
|
#include <srs_core_autofree.hpp>
|
||||||
#include <srs_protocol_json.hpp>
|
#include <srs_protocol_json.hpp>
|
||||||
#include <srs_kernel_buffer.hpp>
|
#include <srs_kernel_buffer.hpp>
|
||||||
using namespace _srs_internal;
|
using namespace srs_internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main scenario to use amf0.
|
* main scenario to use amf0.
|
||||||
|
|
|
@ -35,7 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#define _MIN_OK_CONF "listen 1935; "
|
#define _MIN_OK_CONF "listen 1935; "
|
||||||
|
|
||||||
class MockSrsConfigBuffer : public _srs_internal::SrsConfigBuffer
|
class MockSrsConfigBuffer : public srs_internal::SrsConfigBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MockSrsConfigBuffer(std::string buf);
|
MockSrsConfigBuffer(std::string buf);
|
||||||
|
|
|
@ -3713,11 +3713,11 @@ VOID TEST(KernelFileTest, FileWriteReader)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mock the system call hooks.
|
// Mock the system call hooks.
|
||||||
extern _srs_open_t _srs_open_fn;
|
extern srs_open_t _srs_open_fn;
|
||||||
extern _srs_write_t _srs_write_fn;
|
extern srs_write_t _srs_write_fn;
|
||||||
extern _srs_read_t _srs_read_fn;
|
extern srs_read_t _srs_read_fn;
|
||||||
extern _srs_lseek_t _srs_lseek_fn;
|
extern srs_lseek_t _srs_lseek_fn;
|
||||||
extern _srs_close_t _srs_close_fn;
|
extern srs_close_t _srs_close_fn;
|
||||||
|
|
||||||
int mock_open(const char* /*path*/, int /*oflag*/, ...) {
|
int mock_open(const char* /*path*/, int /*oflag*/, ...) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3742,13 +3742,13 @@ int mock_close(int /*fildes*/) {
|
||||||
class MockSystemIO
|
class MockSystemIO
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
_srs_open_t oo;
|
srs_open_t oo;
|
||||||
_srs_write_t ow;
|
srs_write_t ow;
|
||||||
_srs_read_t _or;
|
srs_read_t _or;
|
||||||
_srs_lseek_t os;
|
srs_lseek_t os;
|
||||||
_srs_close_t oc;
|
srs_close_t oc;
|
||||||
public:
|
public:
|
||||||
MockSystemIO(_srs_open_t o = NULL, _srs_write_t w = NULL, _srs_read_t r = NULL, _srs_lseek_t s = NULL, _srs_close_t c = NULL) {
|
MockSystemIO(srs_open_t o = NULL, srs_write_t w = NULL, srs_read_t r = NULL, srs_lseek_t s = NULL, srs_close_t c = NULL) {
|
||||||
oo = _srs_open_fn;
|
oo = _srs_open_fn;
|
||||||
ow = _srs_write_fn;
|
ow = _srs_write_fn;
|
||||||
os = _srs_lseek_fn;
|
os = _srs_lseek_fn;
|
||||||
|
@ -4191,7 +4191,7 @@ VOID TEST(KernelUtilityTest, CoverBitsBufferAll)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SRS_OSX
|
#ifndef SRS_OSX
|
||||||
extern _srs_gettimeofday_t _srs_gettimeofday;
|
extern srs_gettimeofday_t _srs_gettimeofday;
|
||||||
int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
|
int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -4199,9 +4199,9 @@ int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
|
||||||
class MockTime
|
class MockTime
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
_srs_gettimeofday_t ot;
|
srs_gettimeofday_t ot;
|
||||||
public:
|
public:
|
||||||
MockTime(_srs_gettimeofday_t t = NULL) {
|
MockTime(srs_gettimeofday_t t = NULL) {
|
||||||
ot = _srs_gettimeofday;
|
ot = _srs_gettimeofday;
|
||||||
if (t) {
|
if (t) {
|
||||||
_srs_gettimeofday = t;
|
_srs_gettimeofday = t;
|
||||||
|
|
|
@ -352,7 +352,7 @@ VOID TEST(ProtocolHandshakeTest, OpensslSha256)
|
||||||
// verify the dh key
|
// verify the dh key
|
||||||
VOID TEST(ProtocolHandshakeTest, DHKey)
|
VOID TEST(ProtocolHandshakeTest, DHKey)
|
||||||
{
|
{
|
||||||
_srs_internal::SrsDH dh;
|
srs_internal::SrsDH dh;
|
||||||
|
|
||||||
ASSERT_TRUE(ERROR_SUCCESS == dh.initialize(true));
|
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));
|
EXPECT_TRUE(srs_bytes_equals(pub_key1, pub_key2, 128));
|
||||||
|
|
||||||
// another dh
|
// another dh
|
||||||
_srs_internal::SrsDH dh0;
|
srs_internal::SrsDH dh0;
|
||||||
|
|
||||||
ASSERT_TRUE(ERROR_SUCCESS == dh0.initialize(true));
|
ASSERT_TRUE(ERROR_SUCCESS == dh0.initialize(true));
|
||||||
|
|
||||||
|
|
|
@ -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_stream.hpp>
|
||||||
#include <srs_protocol_kbps.hpp>
|
#include <srs_protocol_kbps.hpp>
|
||||||
|
|
||||||
using namespace _srs_internal;
|
using namespace srs_internal;
|
||||||
|
|
||||||
#include <srs_protocol_io.hpp>
|
#include <srs_protocol_io.hpp>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue