mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Micro changes and refines.
This commit is contained in:
parent
173c683566
commit
378bffa34f
20 changed files with 110 additions and 119 deletions
3
trunk/3rdparty/README.md
vendored
3
trunk/3rdparty/README.md
vendored
|
@ -1,6 +1,7 @@
|
|||
http-parser-2.1.zip
|
||||
* for srs to support http callback.
|
||||
* https://github.com/joyent/http-parser
|
||||
* https://github.com/nodejs/http-parser
|
||||
* https://github.com/ossrs/http-parser
|
||||
* https://ossrs.net/lts/zh-cn/license#http-parser
|
||||
|
||||
nginx-1.5.7.zip
|
||||
|
|
|
@ -2,66 +2,11 @@
|
|||
|
||||
The reference docs.
|
||||
|
||||
## Live Streaming
|
||||
* [SRS 4.0 English](https://ossrs.io/lts/en-us/docs/v4/tools/specs)
|
||||
* [SRS 4.0 中文文档](https://ossrs.net/lts/zh-cn/docs/v4/tools/specs)
|
||||
|
||||
1. [amf0_spec_121207.pdf](http://github.com/ossrs/srs/wiki/doc/amf0_spec_121207.pdf), adobe amf0标准
|
||||
1. [amf3_spec_121207.pdf](http://github.com/ossrs/srs/wiki/doc/amf3_spec_121207.pdf), adobe amf3标准。
|
||||
1. [hls-m3u8-draft-pantos-http-live-streaming-12.txt](http://github.com/ossrs/srs/wiki/doc/hls-m3u8-draft-pantos-http-live-streaming-12.txt), [hls-m3u8-draft-pantos-http-live-streaming-12.pdf](http://github.com/ossrs/srs/wiki/doc/hls-m3u8-draft-pantos-http-live-streaming-12.pdf), m3u8标准。
|
||||
1. [hls-mpeg-ts-iso13818-1.pdf](http://github.com/ossrs/srs/wiki/doc/hls-mpeg-ts-iso13818-1.pdf), ts标准。
|
||||
1. [hls-mpeg-ts-VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf](http://github.com/ossrs/srs/wiki/doc/hls-mpeg-ts-VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf), ts的介绍。
|
||||
1. [rtmp.part1.Chunk-Stream.pdf](http://github.com/ossrs/srs/wiki/doc/rtmp.part1.Chunk-Stream.pdf), [rtmp.part2.Message-Formats.pdf](http://github.com/ossrs/srs/wiki/doc/rtmp.part2.Message-Formats.pdf), [rtmp.part3.Commands-Messages.pdf](http://github.com/ossrs/srs/wiki/doc/rtmp.part3.Commands-Messages.pdf), [rtmp_specification_1.0.pdf](http://github.com/ossrs/srs/wiki/doc/rtmp_specification_1.0.pdf), adobe rtmp标准。
|
||||
1. [flv_v10_1.pdf](http://github.com/ossrs/srs/wiki/doc/flv_v10_1.pdf), adobe flv。
|
||||
1. [video_file_format_spec_v10_1.pdf](http://github.com/ossrs/srs/wiki/doc/video_file_format_spec_v10_1.pdf) flv/f4v.
|
||||
|
||||
## Codec
|
||||
|
||||
1. [mp3.id3v2.3.0.pdf](http://github.com/ossrs/srs/wiki/doc/mp3.id3v2.3.0.pdf), http://id3.org/id3v2.3.0
|
||||
1. [aac-iso-13818-7.pdf, ISO_IEC_13818-7-AAC-2004.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_13818-7-AAC-2004.pdf), aac标准,aac的编码等。
|
||||
1. [aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, ISO_IEC_14496-3-AAC-2001.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-3-AAC-2001.pdf), aac的封装标准,即ts/flv里面的aac raw data标准。
|
||||
1. [ISO_IEC_14496-1-System-2010.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-1-System-2010.pdf) mp4 base box.
|
||||
1. [H.264-AVC-ISO_IEC_14496-10.pdf, ISO_IEC_14496-10-AVC-2003.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-10-AVC-2003.pdf), avc标准,编码部分。
|
||||
1. [H.264-AVC-ISO_IEC_14496-12_2012-mp4.pdf, ISO_IEC_14496-12-base-format-2012.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-12-base-format-2012.pdf), mp4标准。
|
||||
1. [ISO_14496-14_2003_mp4-file-format.pdf, ISO_IEC_14496-14-MP4-2003.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-14-MP4-2003.pdf), mp4文件格式。
|
||||
1. [H.264-AVC-ISO_IEC_14496-10-2012.pdf, ISO_IEC_14496-10-AVC-2012.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-10-AVC-2012.pdf), avc标准,编码部分。上面的标准是2003年的,和下面的15是2010年的对不上。http://www.itu.int/ITU-T/recommendations/rec.aspx?rec=11466
|
||||
1. [H.264-AVC-ISO_IEC_14496-15.pdf, ISO_IEC_14496-15-AVC-format-2012.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_14496-15-AVC-format-2012.pdf), avc标准,封装部分。
|
||||
1. [H.264_MPEG-4-Part-10-White-Paper.pdf](http://github.com/ossrs/srs/wiki/doc/H.264_MPEG-4-Part-10-White-Paper.pdf), h264简介。
|
||||
|
||||
## HTTP
|
||||
|
||||
1. [http1.0-rfc1945.txt, rfc1945-1996-http1.0.txt](http://github.com/ossrs/srs/wiki/doc/rfc1945-1996-http1.0.txt), http://www.rfc-editor.org/rfc/rfc1945.txt
|
||||
1. [http1.1-rfc2616.txt, rfc2616-1999-http1.1.txt](http://github.com/ossrs/srs/wiki/doc/rfc2616-1999-http1.1.txt), http://www.rfc-editor.org/rfc/rfc2616.txt
|
||||
1. [arpa-internet-text-messages-rfc822.txt, rfc822-1982-arpa-internet-text-messages.txt](http://github.com/ossrs/srs/wiki/doc/rfc822-1982-arpa-internet-text-messages.txt), http://www.rfc-editor.org/rfc/rfc822.txt
|
||||
|
||||
## RTC
|
||||
|
||||
1. [STUN, rfc5389-2008-stun.pdf](http://github.com/ossrs/srs/wiki/doc/rfc5389-2008-stun.pdf): https://tools.ietf.org/html/rfc5389
|
||||
1. [TURN, rfc5766-2010-turn.pdf](http://github.com/ossrs/srs/wiki/doc/rfc5766-2010-turn.pdf): https://tools.ietf.org/html/rfc5766
|
||||
1. [ICE, rfc5245-2010-ice.pdf](http://github.com/ossrs/srs/wiki/doc/rfc5245-2010-ice.pdf): https://tools.ietf.org/html/rfc5245
|
||||
1. [SIP, rfc3261-2002-sip.pdf](http://github.com/ossrs/srs/wiki/doc/rfc3261-2002-sip.pdf): https://tools.ietf.org/html/rfc3261
|
||||
|
||||
## SRT
|
||||
|
||||
1. [Haivision_SRT_Open_Source_White_Paper.pdf](http://github.com/ossrs/srs/wiki/doc/Haivision_SRT_Open_Source_White_Paper.pdf)
|
||||
1. [SRT_Alliance_Deployment_Guide.pdf](http://github.com/ossrs/srs/wiki/doc/SRT_Alliance_Deployment_Guide.pdf)
|
||||
1. [SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf](http://github.com/ossrs/srs/wiki/doc/SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf)
|
||||
|
||||
## Others
|
||||
|
||||
1. [kafka-160915-0553-82964.pdf](http://github.com/ossrs/srs/wiki/doc/kafka-160915-0553-82964.pdf), https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol
|
||||
1. [rtmfp-rfc7016.pdf, rfc7016-2013-rtmfp.pdf](http://github.com/ossrs/srs/wiki/doc/rfc7016-2013-rtmfp.pdf), adobe RTMFP, http://tools.ietf.org/html/rfc7016.
|
||||
1. [rtmfp-tsvarea-1.pdf](http://github.com/ossrs/srs/wiki/doc/rtmfp-tsvarea-1.pdf), http://www.ietf.org/proceedings/10mar/slides/tsvarea-1.pdf
|
||||
1. [MPEG-DASH-ISO_IEC_23009-1_2012.pdf, ISO_IEC_23009-1-DASH-2012.pdf](http://github.com/ossrs/srs/wiki/doc/ISO_IEC_23009-1-DASH-2012.pdf), MPEG-DASH标准。
|
||||
1. [rfc2326-1998-rtsp.pdf](http://github.com/ossrs/srs/wiki/doc/rfc2326-1998-rtsp.pdf)
|
||||
1. [rfc3550-2003-rtp.pdf](http://github.com/ossrs/srs/wiki/doc/rfc3550-2003-rtp.pdf)
|
||||
1. [adobe-hds-specification.pdf](http://github.com/ossrs/srs/wiki/doc/adobe-hds-specification.pdf)
|
||||
1. [adobe-media-manifest-specification.pdf](http://github.com/ossrs/srs/wiki/doc/adobe-media-manifest-specification.pdf)
|
||||
1. [HTTPDynamicStreamingSpecificationErrataMay2014.pdf](http://github.com/ossrs/srs/wiki/doc/HTTPDynamicStreamingSpecificationErrataMay2014.pdf)
|
||||
1. [FlashMediaManifestFormatSpecificationErrataMay2014.pdf](http://github.com/ossrs/srs/wiki/doc/FlashMediaManifestFormatSpecificationErrataMay2014.pdf)
|
||||
|
||||
## Files
|
||||
|
||||
1. ffmpeg-logo.png, ffmpeg-min.png, ffmpeg的logo。
|
||||
1. source.flv, source.200kbps.768x320.flv, avatar预告片,400kbps。
|
||||
* [SRS 5.0 English](https://ossrs.io/lts/en-us/docs/v5/tools/specs)
|
||||
* [SRS 5.0 中文文档](https://ossrs.net/lts/zh-cn/docs/v5/tools/specs)
|
||||
|
||||
Winlin
|
||||
|
||||
|
|
45
trunk/research/wireshark/otel.lua
Normal file
45
trunk/research/wireshark/otel.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
-- For OpenTelemetry APM protocol over HTTP, see https://github.com/winlinvip/otel-wireshark-plugin
|
||||
--
|
||||
-- To apply this wireshark plugin:
|
||||
-- mkdir -p ~/.local/lib/wireshark/plugins
|
||||
-- ln -sf $(pwd)/otel.lua ~/.local/lib/wireshark/plugins/otel.lua
|
||||
-- Download proto files for otel:
|
||||
-- git clone https://github.com/open-telemetry/opentelemetry-proto.git
|
||||
-- Setup Wireshark `Protobuf search paths` to load the proto files at `Preferences > Protocols > Protobuf`:
|
||||
-- /home/winlin/git/opentelemetry-proto
|
||||
-- /home/winlin/git/otel-wireshark-plugin/cls
|
||||
-- Start capture or parsing file.
|
||||
|
||||
do
|
||||
function string_starts_with(str, start)
|
||||
return str ~= nil and str:sub(1, #start) == start
|
||||
end
|
||||
|
||||
-- See https://gitlab.com/wireshark/wireshark/-/wikis/Protobuf#write-your-own-protobuf-udp-or-tcp-dissectors
|
||||
local protobuf_dissector = Dissector.get("protobuf")
|
||||
-- Only parsing Protobuf over HTTP, with http uri.
|
||||
local f_http_uri = Field.new("http.request.uri")
|
||||
|
||||
local otel_proto = Proto("otel_proto", "Extra analysis of the HTTP protocol");
|
||||
function otel_proto.dissector(tvb, pinfo, tree)
|
||||
local http_uri = f_http_uri()
|
||||
if http_uri == nil then return end
|
||||
|
||||
-- See https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/collector/trace/v1/trace_service.proto
|
||||
if string_starts_with(http_uri.value, "/v1/traces") then
|
||||
pinfo.private["pb_msg_type"] = "message," .. "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"
|
||||
pcall(Dissector.call, protobuf_dissector, tvb, pinfo, tree)
|
||||
end
|
||||
|
||||
-- See https://cloud.tencent.com/document/api/614/16873
|
||||
if string_starts_with(http_uri.value, "/structuredlog") then
|
||||
pinfo.private["pb_msg_type"] = "message," .. "cls.LogGroupList"
|
||||
pcall(Dissector.call, protobuf_dissector, tvb, pinfo, tree)
|
||||
end
|
||||
end
|
||||
|
||||
local tbl = DissectorTable.get("media_type")
|
||||
tbl:add("application/x-protobuf", otel_proto)
|
||||
print("Add application/x-protobuf dissector", otel_proto)
|
||||
end
|
||||
|
|
@ -142,7 +142,7 @@ void SrsAppCasterFlv::remove(ISrsResource* c)
|
|||
|
||||
std::vector<ISrsConnection*>::iterator it;
|
||||
if ((it = std::find(conns.begin(), conns.end(), conn)) != conns.end()) {
|
||||
conns.erase(it);
|
||||
it = conns.erase(it);
|
||||
}
|
||||
|
||||
// fixbug: ISrsConnection for CasterFlv is not freed, which could cause memory leak
|
||||
|
|
|
@ -206,7 +206,7 @@ void SrsResourceManager::subscribe(ISrsDisposingHandler* h)
|
|||
// Restore the handler from unsubscribing handlers.
|
||||
vector<ISrsDisposingHandler*>::iterator it;
|
||||
if ((it = std::find(unsubs_.begin(), unsubs_.end(), h)) != unsubs_.end()) {
|
||||
unsubs_.erase(it);
|
||||
it = unsubs_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ void SrsResourceManager::unsubscribe(ISrsDisposingHandler* h)
|
|||
{
|
||||
vector<ISrsDisposingHandler*>::iterator it = find(handlers_.begin(), handlers_.end(), h);
|
||||
if (it != handlers_.end()) {
|
||||
handlers_.erase(it);
|
||||
it = handlers_.erase(it);
|
||||
}
|
||||
|
||||
// Put it to the unsubscribing handlers.
|
||||
|
@ -385,7 +385,7 @@ void SrsResourceManager::dispose(ISrsResource* c)
|
|||
|
||||
vector<ISrsResource*>::iterator it = std::find(conns_.begin(), conns_.end(), c);
|
||||
if (it != conns_.end()) {
|
||||
conns_.erase(it);
|
||||
it = conns_.erase(it);
|
||||
}
|
||||
|
||||
// We should copy all handlers, because it may change during callback.
|
||||
|
|
|
@ -166,7 +166,7 @@ void SrsFastTimer::unsubscribe(ISrsFastTimer* timer)
|
|||
{
|
||||
vector<ISrsFastTimer*>::iterator it = std::find(handlers_.begin(), handlers_.end(), timer);
|
||||
if (it != handlers_.end()) {
|
||||
handlers_.erase(it);
|
||||
it = handlers_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,6 +165,10 @@ srs_error_t SrsUdpListener::listen()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// Ignore if not configured.
|
||||
if (ip.empty() || !port) return err;
|
||||
|
||||
srs_close_stfd(lfd);
|
||||
if ((err = srs_udp_listen(ip, port, &lfd)) != srs_success) {
|
||||
return srs_error_wrap(err, "listen %s:%d", ip.c_str(), port);
|
||||
}
|
||||
|
@ -224,7 +228,7 @@ srs_error_t SrsUdpListener::cycle()
|
|||
SrsTcpListener::SrsTcpListener(ISrsTcpHandler* h)
|
||||
{
|
||||
handler = h;
|
||||
port = 0;
|
||||
port_ = 0;
|
||||
lfd = NULL;
|
||||
label_ = "TCP";
|
||||
trd = new SrsDummyCoroutine();
|
||||
|
@ -245,24 +249,32 @@ SrsTcpListener* SrsTcpListener::set_label(const std::string& label)
|
|||
SrsTcpListener* SrsTcpListener::set_endpoint(const std::string& i, int p)
|
||||
{
|
||||
ip = i;
|
||||
port = p;
|
||||
port_ = p;
|
||||
return this;
|
||||
}
|
||||
|
||||
SrsTcpListener* SrsTcpListener::set_endpoint(const std::string& endpoint)
|
||||
{
|
||||
std::string ip; int port;
|
||||
srs_parse_endpoint(endpoint, ip, port);
|
||||
return set_endpoint(ip, port);
|
||||
std::string ip; int port_;
|
||||
srs_parse_endpoint(endpoint, ip, port_);
|
||||
return set_endpoint(ip, port_);
|
||||
}
|
||||
|
||||
int SrsTcpListener::port()
|
||||
{
|
||||
return port_;
|
||||
}
|
||||
|
||||
srs_error_t SrsTcpListener::listen()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// Ignore if not configured.
|
||||
if (ip.empty() || !port_) return err;
|
||||
|
||||
srs_close_stfd(lfd);
|
||||
if ((err = srs_tcp_listen(ip, port, &lfd)) != srs_success) {
|
||||
return srs_error_wrap(err, "listen at %s:%d", ip.c_str(), port);
|
||||
if ((err = srs_tcp_listen(ip, port_, &lfd)) != srs_success) {
|
||||
return srs_error_wrap(err, "listen at %s:%d", ip.c_str(), port_);
|
||||
}
|
||||
|
||||
srs_freep(trd);
|
||||
|
@ -272,7 +284,7 @@ srs_error_t SrsTcpListener::listen()
|
|||
}
|
||||
|
||||
int fd = srs_netfd_fileno(lfd);
|
||||
srs_trace("%s listen at tcp://%s:%d, fd=%d", label_.c_str(), ip.c_str(), port, fd);
|
||||
srs_trace("%s listen at tcp://%s:%d, fd=%d", label_.c_str(), ip.c_str(), port_, fd);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ private:
|
|||
private:
|
||||
ISrsTcpHandler* handler;
|
||||
std::string ip;
|
||||
int port;
|
||||
int port_;
|
||||
public:
|
||||
SrsTcpListener(ISrsTcpHandler* h);
|
||||
virtual ~SrsTcpListener();
|
||||
|
@ -123,6 +123,7 @@ public:
|
|||
SrsTcpListener* set_label(const std::string& label);
|
||||
SrsTcpListener* set_endpoint(const std::string& i, int p);
|
||||
SrsTcpListener* set_endpoint(const std::string& endpoint);
|
||||
int port();
|
||||
public:
|
||||
virtual srs_error_t listen();
|
||||
void close();
|
||||
|
|
|
@ -752,9 +752,11 @@ srs_error_t SrsRtcTcpConn::cycle()
|
|||
SrsStatistic::instance()->on_disconnect(get_id().c_str(), err);
|
||||
SrsStatistic::instance()->kbps_add_delta(get_id().c_str(), delta_);
|
||||
|
||||
// TODO: FIXME: Should manage RTC TCP connection by _srs_rtc_manager.
|
||||
// Because we use manager to manage this object, not the http connection object, so we must remove it here.
|
||||
manager_->remove(this);
|
||||
|
||||
// TODO: FIXME: When TCP connection(transport) closed, should notify session to dispose, should not free them simultaneously.
|
||||
// Only remove session when network is established, because client might use other UDP network.
|
||||
if(session_ && session_->tcp()->is_establelished()) {
|
||||
session_->tcp()->set_state(SrsRtcNetworkStateClosed);
|
||||
|
|
|
@ -57,14 +57,21 @@ public:
|
|||
public:
|
||||
srs_error_t encode(std::ostringstream& os);
|
||||
public:
|
||||
// See https://webrtchacks.com/sdp-anatomy/
|
||||
uint32_t ssrc_;
|
||||
// See https://webrtchacks.com/sdp-anatomy/
|
||||
// a=ssrc:3570614608 cname:4TOk42mSjXCkVIa6
|
||||
std::string cname_;
|
||||
// See https://webrtchacks.com/sdp-anatomy/
|
||||
// a=ssrc:2231627014 msid:lgsCFqt9kN2fVKw5wg3NKqGdATQoltEwOdMS daed9400-d0dd-4db3-b949-422499e96e2d
|
||||
// a=ssrc:2231627014 msid:{msid_} {msid_tracker_}
|
||||
// a=ssrc:3570614608 msid:lgsCFqt9kN2fVKw5wg3NKqGdATQoltEwOdMS 35429d94-5637-4686-9ecd-7d0622261ce8
|
||||
// a=ssrc:3570614608 msid:{msid_} {msid_tracker_}
|
||||
std::string msid_;
|
||||
std::string msid_tracker_;
|
||||
// See https://webrtchacks.com/sdp-anatomy/
|
||||
// a=ssrc:3570614608 mslabel:lgsCFqt9kN2fVKw5wg3NKqGdATQoltEwOdMS
|
||||
std::string mslabel_;
|
||||
// See https://webrtchacks.com/sdp-anatomy/
|
||||
// a=ssrc:3570614608 label:35429d94-5637-4686-9ecd-7d0622261ce8
|
||||
std::string label_;
|
||||
};
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ void SrsRtcSource::on_consumer_destroy(SrsRtcConsumer* consumer)
|
|||
std::vector<SrsRtcConsumer*>::iterator it;
|
||||
it = std::find(consumers.begin(), consumers.end(), consumer);
|
||||
if (it != consumers.end()) {
|
||||
consumers.erase(it);
|
||||
it = consumers.erase(it);
|
||||
}
|
||||
|
||||
// When all consumers finished, notify publisher to handle it.
|
||||
|
@ -599,7 +599,7 @@ void SrsRtcSource::unsubscribe(ISrsRtcSourceEventHandler* h)
|
|||
std::vector<ISrsRtcSourceEventHandler*>::iterator it;
|
||||
it = std::find(event_handlers_.begin(), event_handlers_.end(), h);
|
||||
if (it != event_handlers_.end()) {
|
||||
event_handlers_.erase(it);
|
||||
it = event_handlers_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1135,6 +1135,7 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener* listener, srs_netfd_t& stf
|
|||
if (nn == 10 && b[0] == 0 && b[2] == 0 && b[3] == 1 && b[1] - b[5] == 20
|
||||
&& b[6] == 0x21 && b[7] == 0x12 && b[8] == 0xa4 && b[9] == 0x42
|
||||
) {
|
||||
// TODO: FIXME: Should manage this connection by _srs_rtc_manager
|
||||
resource = new SrsRtcTcpConn(io, ip, port, this);
|
||||
} else {
|
||||
resource = new SrsHttpxConn(listener == http_listener_, this, io, http_server, ip, port);
|
||||
|
@ -1152,8 +1153,11 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener* listener, srs_netfd_t& stf
|
|||
} else if (listener == http_listener_ || listener == https_listener_) {
|
||||
bool is_https = listener == https_listener_;
|
||||
resource = new SrsHttpxConn(is_https, this, new SrsTcpConnection(stfd2), http_server, ip, port);
|
||||
#ifdef SRS_RTC
|
||||
} else if (listener == webrtc_listener_) {
|
||||
// TODO: FIXME: Should manage this connection by _srs_rtc_manager
|
||||
resource = new SrsRtcTcpConn(new SrsTcpConnection(stfd2), ip, port, this);
|
||||
#endif
|
||||
} else {
|
||||
srs_close_stfd(stfd2);
|
||||
srs_warn("Close for invalid fd=%d, ip=%s:%d", fd, ip.c_str(), port);
|
||||
|
|
|
@ -489,7 +489,7 @@ void SrsUnSortedHashtable::set(string key, SrsAmf0Any* value)
|
|||
|
||||
if (key == name) {
|
||||
srs_freep(any);
|
||||
properties.erase(it);
|
||||
it = properties.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,11 @@ ISrsResource::~ISrsResource()
|
|||
{
|
||||
}
|
||||
|
||||
std::string ISrsResource::desc()
|
||||
{
|
||||
return "Resource";
|
||||
}
|
||||
|
||||
ISrsResourceManager::ISrsResourceManager()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
// Get the context id of connection.
|
||||
virtual const SrsContextId& get_id() = 0;
|
||||
// The resource description, optional.
|
||||
virtual std::string desc() = 0;
|
||||
virtual std::string desc();
|
||||
};
|
||||
|
||||
// The manager for resource.
|
||||
|
|
|
@ -19,6 +19,7 @@ using namespace std;
|
|||
#include <srs_core_autofree.hpp>
|
||||
#include <srs_protocol_rtmp_stack.hpp>
|
||||
#include <srs_protocol_conn.hpp>
|
||||
#include <srs_protocol_http_stack.hpp>
|
||||
|
||||
SrsHttpParser::SrsHttpParser()
|
||||
{
|
||||
|
@ -451,24 +452,8 @@ string SrsHttpMessage::method_str()
|
|||
if (jsonp && !jsonp_method.empty()) {
|
||||
return jsonp_method;
|
||||
}
|
||||
|
||||
if (is_http_get()) {
|
||||
return "GET";
|
||||
}
|
||||
if (is_http_put()) {
|
||||
return "PUT";
|
||||
}
|
||||
if (is_http_post()) {
|
||||
return "POST";
|
||||
}
|
||||
if (is_http_delete()) {
|
||||
return "DELETE";
|
||||
}
|
||||
if (is_http_options()) {
|
||||
return "OPTIONS";
|
||||
}
|
||||
|
||||
return "OTHER";
|
||||
|
||||
return http_method_str((http_method)_method);
|
||||
}
|
||||
|
||||
bool SrsHttpMessage::is_http_get()
|
||||
|
|
|
@ -3498,8 +3498,6 @@ VOID TEST(ProtocolStackTest, ProtocolExcpectMessage)
|
|||
|
||||
VOID TEST(ProtocolRTMPTest, RTMPRequest)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsRequest req;
|
||||
std::string param;
|
||||
|
||||
|
|
|
@ -1233,8 +1233,6 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BMin)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, Connections)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
MockWallClock* clock = new MockWallClock();
|
||||
SrsAutoFree(MockWallClock, clock);
|
||||
|
@ -1400,8 +1398,6 @@ VOID TEST(ProtocolKbpsTest, Connections)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, Delta)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
MockWallClock* clock = new MockWallClock();
|
||||
SrsAutoFree(MockWallClock, clock);
|
||||
|
@ -1484,8 +1480,6 @@ VOID TEST(ProtocolKbpsTest, Delta)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, RAWStatistic)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
MockWallClock* clock = new MockWallClock();
|
||||
SrsAutoFree(MockWallClock, clock);
|
||||
|
@ -1650,8 +1644,6 @@ VOID TEST(ProtocolKbpsTest, WriteLargeIOVs)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, ConnectionsSugar)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
MockWallClock* clock = new MockWallClock();
|
||||
SrsAutoFree(MockWallClock, clock);
|
||||
|
@ -1799,8 +1791,6 @@ VOID TEST(ProtocolKbpsTest, ConnectionsSugar)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, DeltaSugar)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
MockWallClock* clock = new MockWallClock();
|
||||
SrsAutoFree(MockWallClock, clock);
|
||||
|
@ -1840,8 +1830,6 @@ VOID TEST(ProtocolKbpsTest, DeltaSugar)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, RAWStatisticSugar)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
MockWallClock* clock = new MockWallClock();
|
||||
SrsAutoFree(MockWallClock, clock);
|
||||
|
@ -2286,8 +2274,6 @@ VOID TEST(ProtocolProtobufTest, FieldKey)
|
|||
|
||||
VOID TEST(ProtocolKbpsTest, NewDelta)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (true) {
|
||||
SrsEphemeralDelta ed;
|
||||
|
||||
|
|
|
@ -515,7 +515,7 @@ VOID TEST(HTTPServerTest, MessageConnection)
|
|||
|
||||
if (true) {
|
||||
SrsHttpMessage m;
|
||||
m.set_basic(HTTP_REQUEST, 100, 0, 0); EXPECT_STREQ("OTHER", m.method_str().c_str());
|
||||
m.set_basic(HTTP_REQUEST, 100, 0, 0); EXPECT_STREQ("<unknown>", m.method_str().c_str());
|
||||
m.set_basic(HTTP_REQUEST, SRS_CONSTS_HTTP_GET, 0, 0); EXPECT_EQ(SRS_CONSTS_HTTP_GET, m.method()); EXPECT_STREQ("GET", m.method_str().c_str());
|
||||
m.set_basic(HTTP_REQUEST, SRS_CONSTS_HTTP_PUT, 0, 0); EXPECT_EQ(SRS_CONSTS_HTTP_PUT, m.method()); EXPECT_STREQ("PUT", m.method_str().c_str());
|
||||
m.set_basic(HTTP_REQUEST, SRS_CONSTS_HTTP_POST, 0, 0); EXPECT_EQ(SRS_CONSTS_HTTP_POST, m.method()); EXPECT_STREQ("POST", m.method_str().c_str());
|
||||
|
|
|
@ -178,7 +178,7 @@ VOID TEST(ServiceStSRTTest, ListenConnectAccept)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
std::string server_ip = "127.0.0.1";
|
||||
int server_port = 9000;
|
||||
int server_port = 19000;
|
||||
|
||||
MockSrtServer srt_server;
|
||||
HELPER_EXPECT_SUCCESS(srt_server.create_socket());
|
||||
|
@ -223,7 +223,7 @@ VOID TEST(ServiceStSRTTest, ConnectWithStreamid)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
std::string server_ip = "127.0.0.1";
|
||||
int server_port = 9000;
|
||||
int server_port = 19000;
|
||||
|
||||
MockSrtServer srt_server;
|
||||
HELPER_EXPECT_SUCCESS(srt_server.create_socket());
|
||||
|
@ -235,7 +235,7 @@ VOID TEST(ServiceStSRTTest, ConnectWithStreamid)
|
|||
HELPER_EXPECT_SUCCESS(srs_srt_set_streamid(srt_client_fd, streamid));
|
||||
SrsSrtSocket* srt_client_socket = new SrsSrtSocket(_srt_eventloop->poller(), srt_client_fd);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(srt_client_socket->connect("127.0.0.1", 9000));
|
||||
HELPER_EXPECT_SUCCESS(srt_client_socket->connect(server_ip, server_port));
|
||||
|
||||
srs_srt_t srt_server_accepted_fd = srs_srt_socket_invalid();
|
||||
HELPER_EXPECT_SUCCESS(srt_server.accept(&srt_server_accepted_fd));
|
||||
|
@ -250,7 +250,7 @@ VOID TEST(ServiceStSRTTest, ReadWrite)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
std::string server_ip = "127.0.0.1";
|
||||
int server_port = 9000;
|
||||
int server_port = 19000;
|
||||
|
||||
MockSrtServer srt_server;
|
||||
HELPER_EXPECT_SUCCESS(srt_server.create_socket());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue