mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix the hstrs bug on edge.
This commit is contained in:
parent
99db2888e7
commit
3b65af9bd2
1 changed files with 16 additions and 5 deletions
|
@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <srs_app_http_stream.hpp>
|
#include <srs_app_http_stream.hpp>
|
||||||
|
|
||||||
|
#define SRS_STREAM_CACHE_CYCLE_SECONDS 30
|
||||||
|
|
||||||
#if defined(SRS_AUTO_HTTP_CORE)
|
#if defined(SRS_AUTO_HTTP_CORE)
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -107,6 +109,7 @@ int SrsStreamCache::cycle()
|
||||||
|
|
||||||
// TODO: FIXME: support reload.
|
// TODO: FIXME: support reload.
|
||||||
if (fast_cache <= 0) {
|
if (fast_cache <= 0) {
|
||||||
|
st_sleep(SRS_STREAM_CACHE_CYCLE_SECONDS);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1139,8 +1142,10 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
|
||||||
}
|
}
|
||||||
|
|
||||||
// hstrs not enabled, ignore.
|
// hstrs not enabled, ignore.
|
||||||
// for origin: generally set hstrs to 'off' and mount while stream is pushed to origin.
|
// for origin, the http stream will be mount already when publish,
|
||||||
// for edge: must set hstrs to 'on' so that it could trigger rtmp stream before mount.
|
// so it must never enter this line for stream already mounted.
|
||||||
|
// for edge, the http stream is trigger by hstrs and mount by it,
|
||||||
|
// so we only hijack when only edge and hstrs is on.
|
||||||
entry = it->second;
|
entry = it->second;
|
||||||
if (!entry->hstrs) {
|
if (!entry->hstrs) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1177,14 +1182,20 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
|
||||||
SrsAutoFree(SrsRequest, r);
|
SrsAutoFree(SrsRequest, r);
|
||||||
|
|
||||||
std::string sid = r->get_stream_url();
|
std::string sid = r->get_stream_url();
|
||||||
// check if the stream is enabled.
|
// check whether the http remux is enabled,
|
||||||
|
// for example, user disable the http flv then reload.
|
||||||
if (sflvs.find(sid) != sflvs.end()) {
|
if (sflvs.find(sid) != sflvs.end()) {
|
||||||
SrsLiveEntry* s_entry = sflvs[sid];
|
SrsLiveEntry* s_entry = sflvs[sid];
|
||||||
if (!s_entry->stream->entry->enabled) {
|
if (!s_entry->stream->entry->enabled) {
|
||||||
|
// only when the http entry is disabled, check the config whether http flv disable,
|
||||||
|
// for the http flv edge use hijack to trigger the edge ingester, we always mount it
|
||||||
|
// eventhough the origin does not exists the specified stream.
|
||||||
|
if (!_srs_config->get_vhost_http_remux_enabled(r->vhost)) {
|
||||||
srs_error("stream is disabled, hijack failed. ret=%d", ret);
|
srs_error("stream is disabled, hijack failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SrsSource* s = SrsSource::fetch(r);
|
SrsSource* s = SrsSource::fetch(r);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue