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

STAT: Refine tcUrl for SRT/RTC. v5.0.54

This commit is contained in:
winlin 2022-08-30 19:35:14 +08:00
parent d877c0b76f
commit 9c6774b644
21 changed files with 121 additions and 36 deletions

View file

@ -72,6 +72,10 @@ srs_error_t SrsHlsStream::serve_m3u8_ctx(ISrsHttpResponseWriter* w, ISrsHttpMess
{
string ctx = r->query_get(SRS_CONTEXT_IN_HLS);
// Correct the app and stream by path, which is created from template.
// @remark Be careful that the stream has extension now, might cause identify fail.
req->stream = srs_path_basename(r->path());
// Always make the ctx alive now.
alive(ctx, req);

View file

@ -523,6 +523,10 @@ srs_error_t SrsLiveStream::update_auth(SrsLiveSource* s, SrsRequest* r)
srs_error_t SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
srs_error_t err = srs_success;
// Correct the app and stream by path, which is created from template.
// @remark Be careful that the stream has extension now, might cause identify fail.
req->stream = srs_path_basename(r->path());
if ((err = http_hooks_on_play(r)) != srs_success) {
return srs_error_wrap(err, "http hook");
@ -588,7 +592,7 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
SrsHttpConn* hc = dynamic_cast<SrsHttpConn*>(hr->connection());
// update client ip
req->ip = hc->remote_ip();
req->ip = hc->remote_ip();
// update the statistic when source disconveried.
SrsStatistic* stat = SrsStatistic::instance();

View file

@ -263,7 +263,7 @@ srs_error_t SrsMpegtsSrtConn::do_cycle()
// Detect streamid of srt to request.
SrtMode mode = SrtModePull;
if (! srs_srt_streamid_to_request(streamid, mode, req_)) {
if (!srs_srt_streamid_to_request(streamid, mode, req_)) {
return srs_error_new(ERROR_SRT_CONN, "invalid srt streamid=%s", streamid.c_str());
}
@ -288,9 +288,6 @@ srs_error_t SrsMpegtsSrtConn::do_cycle()
return srs_error_wrap(err, "on connect");
}
// Build the tcUrl which is vhost/app.
req_->tcUrl = srs_generate_tc_url(req_->host, req_->vhost, req_->app, req_->port);
if (mode == SrtModePush) {
err = publishing();
} else if (mode == SrtModePull) {

View file

@ -139,5 +139,9 @@ bool srs_srt_streamid_to_request(const std::string& streamid, SrtMode& mode, Srs
request->param = stream_with_params.substr(pos + 1);
}
request->host = srs_get_public_internet_address();
if (request->vhost.empty()) request->vhost = request->host;
request->tcUrl = srs_generate_tc_url("srt", request->host, request->vhost, request->app, request->port);
return ret;
}