Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Add service_id for http_hooks, which identify the process #3424

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for SRS.

## SRS 6.0 Changelog

* v6.0, 2023-02-25, Merge [#3424](https://github.com/ossrs/srs/pull/3424): API: Add service_id for http_hooks, which identify the process. v6.0.28 (#3424)
* v6.0, 2023-02-22, Compatible with legacy RTMP URL. v6.0.27
* v6.0, 2023-02-16, Merge [#3411](https://github.com/ossrs/srs/pull/3411): HEVC: Fix nalu vec duplicate when h265 vps/sps/pps demux. v6.0.26 (#3411)
* v6.0, 2023-02-14, Merge [#3408](https://github.com/ossrs/srs/pull/3408): GB: Support H.265 for GB28181. v6.0.25 (#3408)
Expand Down Expand Up @@ -41,6 +42,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* v5.0, 2023-02-25, Merge [#3424](https://github.com/ossrs/srs/pull/3424): API: Add service_id for http_hooks, which identify the process. v5.0.142 (#3424)
* v5.0, 2023-02-22, Compatible with legacy RTMP URL. v5.0.142
* v5.0, 2023-02-12, Merge [#3409](https://github.com/ossrs/srs/pull/3409): SRT: Reduce latency to 200ms of srt2rtc.conf. v5.0.141 (#3409)
* v5.0, 2023-02-08, Merge [#3391](https://github.com/ossrs/srs/pull/3391): Config: Error when both HLS and HTTP-TS enabled. v5.0.140 (#3391)
Expand Down
10 changes: 10 additions & 0 deletions trunk/src/app/srs_app_http_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ srs_error_t SrsHttpHooks::on_connect(string url, SrsRequest* req)
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_connect"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -91,6 +92,7 @@ void SrsHttpHooks::on_close(string url, SrsRequest* req, int64_t send_bytes, int
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_close"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -130,6 +132,7 @@ srs_error_t SrsHttpHooks::on_publish(string url, SrsRequest* req)
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_publish"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -173,6 +176,7 @@ void SrsHttpHooks::on_unpublish(string url, SrsRequest* req)
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_unpublish"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -219,6 +223,7 @@ srs_error_t SrsHttpHooks::on_play(string url, SrsRequest* req)
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_play"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -263,6 +268,7 @@ void SrsHttpHooks::on_stop(string url, SrsRequest* req)
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_stop"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -310,6 +316,7 @@ srs_error_t SrsHttpHooks::on_dvr(SrsContextId c, string url, SrsRequest* req, st
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_dvr"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -362,6 +369,7 @@ srs_error_t SrsHttpHooks::on_hls(SrsContextId c, string url, SrsRequest* req, st
SrsAutoFree(SrsJsonObject, obj);

obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("action", SrsJsonAny::str("on_hls"));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
Expand Down Expand Up @@ -413,6 +421,7 @@ srs_error_t SrsHttpHooks::on_hls_notify(SrsContextId c, std::string url, SrsRequ
SrsStatistic* stat = SrsStatistic::instance();

url = srs_string_replace(url, "[server_id]", stat->server_id().c_str());
url = srs_string_replace(url, "[service_id]", stat->service_id().c_str());
url = srs_string_replace(url, "[app]", req->app);
url = srs_string_replace(url, "[stream]", req->stream);
url = srs_string_replace(url, "[ts_url]", ts_url);
Expand Down Expand Up @@ -537,6 +546,7 @@ srs_error_t SrsHttpHooks::on_forward_backend(string url, SrsRequest* req, std::v

obj->set("action", SrsJsonAny::str("on_forward"));
obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("service_id", SrsJsonAny::str(stat->service_id().c_str()));
obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str()));
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 142
#define VERSION_REVISION 143

#endif
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 27
#define VERSION_REVISION 28

#endif