Skip to content

Commit

Permalink
fix bug: use the correct 'client_id' in 'on_unpublish'
Browse files Browse the repository at this point in the history
  • Loading branch information
Haibo Chen committed Sep 27, 2021
1 parent 43d5f7b commit 7f09326
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions trunk/src/app/srs_app_http_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,10 @@ srs_error_t SrsHttpHooks::on_publish(string url, SrsRequest* req)
return err;
}

void SrsHttpHooks::on_unpublish(string url, SrsRequest* req)
void SrsHttpHooks::on_unpublish(SrsContextId cid, string url, SrsRequest* req)
{
srs_error_t err = srs_success;

SrsContextId cid = _srs_context->get_id();


SrsStatistic* stat = SrsStatistic::instance();

SrsJsonObject* obj = SrsJsonAny::object();
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_http_hooks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SrsHttpHooks
// The on_unpublish hook, when client(encoder) stop publish stream.
// @param url the api server url, to process the event.
// ignore if empty.
static void on_unpublish(std::string url, SrsRequest* req);
static void on_unpublish(SrsContextId cid, std::string url, SrsRequest* req);
// The on_play hook, when client start to play stream.
// @param url the api server url, to valid the client.
// ignore if empty.
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ srs_error_t SrsRtcAsyncCallOnUnpublish::call()

for (int i = 0; i < (int)hooks.size(); i++) {
std::string url = hooks.at(i);
SrsHttpHooks::on_unpublish(url, req);
SrsHttpHooks::on_unpublish(cid, url, req);
}

return err;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_rtmp_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ void SrsRtmpConn::http_hooks_on_unpublish()

for (int i = 0; i < (int)hooks.size(); i++) {
std::string url = hooks.at(i);
SrsHttpHooks::on_unpublish(url, req);
SrsHttpHooks::on_unpublish(_srs_context->get_id(), url, req);
}
}

Expand Down

0 comments on commit 7f09326

Please sign in to comment.