mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #1339, Support HTTP-FLV params. 2.0.262
This commit is contained in:
parent
ab833943e1
commit
91c462b6ba
5 changed files with 25 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -28,3 +28,5 @@
|
||||||
|
|
||||||
# Apple-specific garbage files.
|
# Apple-specific garbage files.
|
||||||
.AppleDouble
|
.AppleDouble
|
||||||
|
|
||||||
|
.idea
|
||||||
|
|
|
@ -335,6 +335,7 @@ Remark:
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
* v2.0, 2019-04-05, Merge [#1339][bug #1339], Support HTTP-FLV params. 2.0.262
|
||||||
* v2.0, 2018-12-01, Merge [#1274][bug #1274], Upgrade to FFMPEG 4.1 and X264 157. 2.0.261
|
* v2.0, 2018-12-01, Merge [#1274][bug #1274], Upgrade to FFMPEG 4.1 and X264 157. 2.0.261
|
||||||
* v2.0, 2018-11-11, Merge [#1261][bug #1261], Support `_definst_` for Wowza. 2.0.260
|
* v2.0, 2018-11-11, Merge [#1261][bug #1261], Support `_definst_` for Wowza. 2.0.260
|
||||||
* v2.0, 2018-11-11, Merge [#1263][bug #1263], Fix string trim bug. 2.0.259
|
* v2.0, 2018-11-11, Merge [#1263][bug #1263], Fix string trim bug. 2.0.259
|
||||||
|
@ -1342,6 +1343,7 @@ Winlin
|
||||||
[bug #1263]: https://github.com/ossrs/srs/issues/1263
|
[bug #1263]: https://github.com/ossrs/srs/issues/1263
|
||||||
[bug #1261]: https://github.com/ossrs/srs/issues/1261
|
[bug #1261]: https://github.com/ossrs/srs/issues/1261
|
||||||
[bug #1274]: https://github.com/ossrs/srs/pull/1274
|
[bug #1274]: https://github.com/ossrs/srs/pull/1274
|
||||||
|
[bug #1339]: https://github.com/ossrs/srs/pull/1339
|
||||||
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
|
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
|
||||||
|
|
||||||
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
||||||
|
|
|
@ -481,14 +481,14 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
if ((ret = http_hooks_on_play()) != ERROR_SUCCESS) {
|
if ((ret = http_hooks_on_play(r)) != ERROR_SUCCESS) {
|
||||||
srs_error("http hook on_play failed. ret=%d", ret);
|
srs_error("http hook on_play failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = do_serve_http(w, r);
|
ret = do_serve_http(w, r);
|
||||||
|
|
||||||
http_hooks_on_stop();
|
http_hooks_on_stop(r);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ int SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsLiveStream::http_hooks_on_play()
|
int SrsLiveStream::http_hooks_on_play(ISrsHttpMessage* r)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
@ -644,6 +644,11 @@ int SrsLiveStream::http_hooks_on_play()
|
||||||
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
|
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create request to report for the specified connection.
|
||||||
|
SrsHttpMessage* hr = dynamic_cast<SrsHttpMessage*>(r);
|
||||||
|
SrsRequest* nreq = hr->to_request(req->vhost);
|
||||||
|
SrsAutoFree(SrsRequest, nreq);
|
||||||
|
|
||||||
// the http hooks will cause context switch,
|
// the http hooks will cause context switch,
|
||||||
// so we must copy all hooks for the on_connect may freed.
|
// so we must copy all hooks for the on_connect may freed.
|
||||||
|
@ -651,7 +656,7 @@ int SrsLiveStream::http_hooks_on_play()
|
||||||
vector<string> hooks;
|
vector<string> hooks;
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
SrsConfDirective* conf = _srs_config->get_vhost_on_play(req->vhost);
|
SrsConfDirective* conf = _srs_config->get_vhost_on_play(nreq->vhost);
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
srs_info("ignore the empty http callback: on_play");
|
srs_info("ignore the empty http callback: on_play");
|
||||||
|
@ -663,7 +668,7 @@ int SrsLiveStream::http_hooks_on_play()
|
||||||
|
|
||||||
for (int i = 0; i < (int)hooks.size(); i++) {
|
for (int i = 0; i < (int)hooks.size(); i++) {
|
||||||
std::string url = hooks.at(i);
|
std::string url = hooks.at(i);
|
||||||
if ((ret = SrsHttpHooks::on_play(url, req)) != ERROR_SUCCESS) {
|
if ((ret = SrsHttpHooks::on_play(url, nreq)) != ERROR_SUCCESS) {
|
||||||
srs_error("hook client on_play failed. url=%s, ret=%d", url.c_str(), ret);
|
srs_error("hook client on_play failed. url=%s, ret=%d", url.c_str(), ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -673,12 +678,17 @@ int SrsLiveStream::http_hooks_on_play()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsLiveStream::http_hooks_on_stop()
|
void SrsLiveStream::http_hooks_on_stop(ISrsHttpMessage* r)
|
||||||
{
|
{
|
||||||
#ifdef SRS_AUTO_HTTP_CALLBACK
|
#ifdef SRS_AUTO_HTTP_CALLBACK
|
||||||
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
|
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create request to report for the specified connection.
|
||||||
|
SrsHttpMessage* hr = dynamic_cast<SrsHttpMessage*>(r);
|
||||||
|
SrsRequest* nreq = hr->to_request(req->vhost);
|
||||||
|
SrsAutoFree(SrsRequest, nreq);
|
||||||
|
|
||||||
// the http hooks will cause context switch,
|
// the http hooks will cause context switch,
|
||||||
// so we must copy all hooks for the on_connect may freed.
|
// so we must copy all hooks for the on_connect may freed.
|
||||||
|
@ -686,7 +696,7 @@ void SrsLiveStream::http_hooks_on_stop()
|
||||||
vector<string> hooks;
|
vector<string> hooks;
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
SrsConfDirective* conf = _srs_config->get_vhost_on_stop(req->vhost);
|
SrsConfDirective* conf = _srs_config->get_vhost_on_stop(nreq->vhost);
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
srs_info("ignore the empty http callback: on_stop");
|
srs_info("ignore the empty http callback: on_stop");
|
||||||
|
@ -698,7 +708,7 @@ void SrsLiveStream::http_hooks_on_stop()
|
||||||
|
|
||||||
for (int i = 0; i < (int)hooks.size(); i++) {
|
for (int i = 0; i < (int)hooks.size(); i++) {
|
||||||
std::string url = hooks.at(i);
|
std::string url = hooks.at(i);
|
||||||
SrsHttpHooks::on_stop(url, req);
|
SrsHttpHooks::on_stop(url, nreq);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -233,8 +233,8 @@ public:
|
||||||
virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
||||||
private:
|
private:
|
||||||
virtual int do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
virtual int do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
||||||
virtual int http_hooks_on_play();
|
virtual int http_hooks_on_play(ISrsHttpMessage* r);
|
||||||
virtual void http_hooks_on_stop();
|
virtual void http_hooks_on_stop(ISrsHttpMessage* r);
|
||||||
virtual int streaming_send_messages(ISrsStreamEncoder* enc, SrsSharedPtrMessage** msgs, int nb_msgs);
|
virtual int streaming_send_messages(ISrsStreamEncoder* enc, SrsSharedPtrMessage** msgs, int nb_msgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR 2
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 261
|
#define VERSION_REVISION 262
|
||||||
|
|
||||||
// generated by configure, only macros.
|
// generated by configure, only macros.
|
||||||
#include <srs_auto_headers.hpp>
|
#include <srs_auto_headers.hpp>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue