|
|
@ -438,32 +438,43 @@ public:
|
|
|
|
virtual srs_error_t update_vsh(SrsSharedPtrMessage* msg);
|
|
|
|
virtual srs_error_t update_vsh(SrsSharedPtrMessage* msg);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// live streaming source.
|
|
|
|
// The source manager to create and refresh all stream sources.
|
|
|
|
class SrsSource : public ISrsReloadHandler
|
|
|
|
class SrsSourceManager
|
|
|
|
{
|
|
|
|
{
|
|
|
|
friend class SrsOriginHub;
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
static std::map<std::string, SrsSource*> pool;
|
|
|
|
std::map<std::string, SrsSource*> pool;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SrsSourceManager();
|
|
|
|
|
|
|
|
virtual ~SrsSourceManager();
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// create source when fetch from cache failed.
|
|
|
|
// create source when fetch from cache failed.
|
|
|
|
// @param r the client request.
|
|
|
|
// @param r the client request.
|
|
|
|
// @param h the event handler for source.
|
|
|
|
// @param h the event handler for source.
|
|
|
|
// @param pps the matched source, if success never be NULL.
|
|
|
|
// @param pps the matched source, if success never be NULL.
|
|
|
|
static srs_error_t fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, SrsSource** pps);
|
|
|
|
virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, SrsSource** pps);
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
// Get the exists source, NULL when not exists.
|
|
|
|
// Get the exists source, NULL when not exists.
|
|
|
|
// update the request and return the exists source.
|
|
|
|
// update the request and return the exists source.
|
|
|
|
static SrsSource* fetch(SrsRequest* r);
|
|
|
|
virtual SrsSource* fetch(SrsRequest* r);
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// dispose and cycle all sources.
|
|
|
|
// dispose and cycle all sources.
|
|
|
|
static void dispose_all();
|
|
|
|
virtual void dispose();
|
|
|
|
static srs_error_t cycle_all();
|
|
|
|
virtual srs_error_t cycle();
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
static srs_error_t do_cycle_all();
|
|
|
|
virtual srs_error_t do_cycle();
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// when system exit, destroy the sources,
|
|
|
|
// when system exit, destroy the sources,
|
|
|
|
// For gmc to analysis mem leaks.
|
|
|
|
// For gmc to analysis mem leaks.
|
|
|
|
static void destroy();
|
|
|
|
virtual void destroy();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Global singleton instance.
|
|
|
|
|
|
|
|
extern SrsSourceManager* _srs_sources;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// live streaming source.
|
|
|
|
|
|
|
|
class SrsSource : public ISrsReloadHandler
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
friend class SrsOriginHub;
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
// For publish, it's the publish client id.
|
|
|
|
// For publish, it's the publish client id.
|
|
|
|
// For edge, it's the edge ingest id.
|
|
|
|
// For edge, it's the edge ingest id.
|
|
|
@ -531,6 +542,8 @@ public:
|
|
|
|
// Whether source is inactive, which means there is no publishing stream source.
|
|
|
|
// Whether source is inactive, which means there is no publishing stream source.
|
|
|
|
// @remark For edge, it's inactive util stream has been pulled from origin.
|
|
|
|
// @remark For edge, it's inactive util stream has been pulled from origin.
|
|
|
|
virtual bool inactive();
|
|
|
|
virtual bool inactive();
|
|
|
|
|
|
|
|
// Update the authentication information in request.
|
|
|
|
|
|
|
|
virtual void update_auth(SrsRequest* r);
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
virtual bool can_publish(bool is_edge);
|
|
|
|
virtual bool can_publish(bool is_edge);
|
|
|
|
virtual srs_error_t on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata);
|
|
|
|
virtual srs_error_t on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata);
|
|
|
|