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

fix #435, add pageUrl for HTTP callback on_play.

This commit is contained in:
winlin 2015-07-21 10:50:57 +08:00
parent b54f9b0f94
commit 31d2de3f23
6 changed files with 21 additions and 10 deletions

View file

@ -344,6 +344,7 @@ Remark:
### SRS 2.0 history ### SRS 2.0 history
* v2.0, 2015-07-21, fix [#435](https://github.com/simple-rtmp-server/srs/issues/435) add pageUrl for HTTP callback on_play.
* v2.0, 2015-07-20, refine the hls, ignore packet when no sequence header. 2.0.179 * v2.0, 2015-07-20, refine the hls, ignore packet when no sequence header. 2.0.179
* v2.0, 2015-07-16, for [#441](https://github.com/simple-rtmp-server/srs/issues/441) use 30s timeout for first msg. 2.0.178 * v2.0, 2015-07-16, for [#441](https://github.com/simple-rtmp-server/srs/issues/441) use 30s timeout for first msg. 2.0.178
* v2.0, 2015-07-14, refine hls disable the time jitter, support not mix monotonically increase. 2.0.177 * v2.0, 2015-07-14, refine hls disable the time jitter, support not mix monotonically increase. 2.0.177

View file

@ -434,7 +434,7 @@ vhost ingest.srs.com {
# vhost for http static and flv vod stream for each vhost. # vhost for http static and flv vod stream for each vhost.
vhost http.static.srs.com { vhost http.static.srs.com {
# http static vhost specified config # http static vhost specified config
http { http_static {
# whether enabled the http static service for vhost. # whether enabled the http static service for vhost.
# default: off # default: off
enabled on; enabled on;
@ -707,7 +707,8 @@ vhost hooks.callback.srs.com {
# { # {
# "action": "on_close", # "action": "on_close",
# "client_id": 1985, # "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live" # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "send_bytes": 10240, "recv_bytes": 10240
# } # }
# if valid, the hook must return HTTP code 200(Stauts OK) and response # if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success): # an int value specifies the error code(0 corresponding to success):
@ -749,7 +750,8 @@ vhost hooks.callback.srs.com {
# "action": "on_play", # "action": "on_play",
# "client_id": 1985, # "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream" # "stream": "livestream",
# "pageUrl": "http://www.test.com/live.html"
# } # }
# if valid, the hook must return HTTP code 200(Stauts OK) and response # if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success): # an int value specifies the error code(0 corresponding to success):

View file

@ -96,7 +96,8 @@ class RESTClients(object):
{ {
"action": "on_close", "action": "on_close",
"client_id": 1985, "client_id": 1985,
"ip": "192.168.1.10", "vhost": "video.test.com", "app": "live" "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
"send_bytes": 10240, "recv_bytes": 10240
} }
if valid, the hook must return HTTP code 200(Stauts OK) and response if valid, the hook must return HTTP code 200(Stauts OK) and response
an int value specifies the error code(0 corresponding to success): an int value specifies the error code(0 corresponding to success):
@ -145,8 +146,8 @@ class RESTClients(object):
def __on_close(self, req): def __on_close(self, req):
code = Error.success code = Error.success
trace("srs %s: client id=%s, ip=%s, vhost=%s, app=%s"%( trace("srs %s: client id=%s, ip=%s, vhost=%s, app=%s, send_bytes=%s, recv_bytes=%s"%(
req["action"], req["client_id"], req["ip"], req["vhost"], req["app"] req["action"], req["client_id"], req["ip"], req["vhost"], req["app"], req["send_bytes"], req["recv_bytes"]
)) ))
# TODO: process the on_close event # TODO: process the on_close event
@ -450,7 +451,8 @@ class RESTSessions(object):
"action": "on_play", "action": "on_play",
"client_id": 1985, "client_id": 1985,
"ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
"stream": "livestream" "stream": "livestream",
"pageUrl": "http://www.test.com/live.html"
} }
on_stop: on_stop:
when client(encoder) stop publish to vhost/app/stream, call the hook, when client(encoder) stop publish to vhost/app/stream, call the hook,
@ -497,8 +499,8 @@ class RESTSessions(object):
def __on_play(self, req): def __on_play(self, req):
code = Error.success code = Error.success
trace("srs %s: client id=%s, ip=%s, vhost=%s, app=%s, stream=%s"%( trace("srs %s: client id=%s, ip=%s, vhost=%s, app=%s, stream=%s, pageUrl=%s"%(
req["action"], req["client_id"], req["ip"], req["vhost"], req["app"], req["stream"] req["action"], req["client_id"], req["ip"], req["vhost"], req["app"], req["stream"], req["pageUrl"]
)) ))
# TODO: process the on_play event # TODO: process the on_play event

View file

@ -203,7 +203,8 @@ int SrsHttpHooks::on_play(string url, SrsRequest* req)
<< SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("pageUrl", req->pageUrl)
<< SRS_JOBJECT_END; << SRS_JOBJECT_END;
std::string data = ss.str(); std::string data = ss.str();

View file

@ -57,6 +57,7 @@ public:
virtual int on_reload_http_stream_disabled(); virtual int on_reload_http_stream_disabled();
virtual int on_reload_http_stream_updated(); virtual int on_reload_http_stream_updated();
public: public:
// TODO: FIXME: should rename to http_static
virtual int on_reload_vhost_http_updated(); virtual int on_reload_vhost_http_updated();
virtual int on_reload_vhost_http_remux_updated(std::string vhost); virtual int on_reload_vhost_http_remux_updated(std::string vhost);
virtual int on_reload_vhost_added(std::string vhost); virtual int on_reload_vhost_added(std::string vhost);

View file

@ -1270,6 +1270,7 @@ int SrsServer::on_reload_vhost_added(std::string vhost)
return ret; return ret;
} }
// TODO: FIXME: should handle the event in SrsHttpStaticServer
if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) { if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
return ret; return ret;
} }
@ -1283,6 +1284,7 @@ int SrsServer::on_reload_vhost_removed(std::string /*vhost*/)
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER #ifdef SRS_AUTO_HTTP_SERVER
// TODO: FIXME: should handle the event in SrsHttpStaticServer
if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) { if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
return ret; return ret;
} }
@ -1335,6 +1337,7 @@ int SrsServer::on_reload_http_stream_disabled()
return ret; return ret;
} }
// TODO: FIXME: rename to http_remux
int SrsServer::on_reload_http_stream_updated() int SrsServer::on_reload_http_stream_updated()
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
@ -1344,6 +1347,7 @@ int SrsServer::on_reload_http_stream_updated()
return ret; return ret;
} }
// TODO: FIXME: should handle the event in SrsHttpStaticServer
if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) { if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
return ret; return ret;
} }