Committed by
winlin
Modified on_close webhook.
Pass the send_bytes and recv_bytes count to the web hook.
正在显示
3 个修改的文件
包含
5 行增加
和
3 行删除
| @@ -82,7 +82,7 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r | @@ -82,7 +82,7 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r | ||
| 82 | return ret; | 82 | return ret; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | -void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req) | 85 | +void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes) |
| 86 | { | 86 | { |
| 87 | int ret = ERROR_SUCCESS; | 87 | int ret = ERROR_SUCCESS; |
| 88 | 88 | ||
| @@ -92,6 +92,8 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re | @@ -92,6 +92,8 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re | ||
| 92 | << __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT | 92 | << __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT |
| 93 | << __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT | 93 | << __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT |
| 94 | << __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT | 94 | << __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT |
| 95 | + << __SRS_JFIELD_ORG("send_bytes", send_bytes) << __SRS_JFIELD_CONT | ||
| 96 | + << __SRS_JFIELD_ORG("recv_bytes", recv_bytes) << __SRS_JFIELD_CONT | ||
| 95 | << __SRS_JFIELD_STR("app", req->app) | 97 | << __SRS_JFIELD_STR("app", req->app) |
| 96 | << __SRS_JOBJECT_END; | 98 | << __SRS_JOBJECT_END; |
| 97 | 99 |
| @@ -66,7 +66,7 @@ public: | @@ -66,7 +66,7 @@ public: | ||
| 66 | * @param url the api server url, to process the event. | 66 | * @param url the api server url, to process the event. |
| 67 | * ignore if empty. | 67 | * ignore if empty. |
| 68 | */ | 68 | */ |
| 69 | - static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req); | 69 | + static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes); |
| 70 | /** | 70 | /** |
| 71 | * on_publish hook, when client(encoder) start to publish stream | 71 | * on_publish hook, when client(encoder) start to publish stream |
| 72 | * @param client_id the id of client on server. | 72 | * @param client_id the id of client on server. |
| @@ -1294,7 +1294,7 @@ void SrsRtmpConn::http_hooks_on_close() | @@ -1294,7 +1294,7 @@ void SrsRtmpConn::http_hooks_on_close() | ||
| 1294 | int connection_id = _srs_context->get_id(); | 1294 | int connection_id = _srs_context->get_id(); |
| 1295 | for (int i = 0; i < (int)on_close->args.size(); i++) { | 1295 | for (int i = 0; i < (int)on_close->args.size(); i++) { |
| 1296 | std::string url = on_close->args.at(i); | 1296 | std::string url = on_close->args.at(i); |
| 1297 | - SrsHttpHooks::on_close(url, connection_id, ip, req); | 1297 | + SrsHttpHooks::on_close(url, connection_id, ip, req, skt->get_send_bytes(), skt->get_recv_bytes()); |
| 1298 | } | 1298 | } |
| 1299 | } | 1299 | } |
| 1300 | #endif | 1300 | #endif |
-
请 注册 或 登录 后发表评论