mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
Rename SrsSource* to SrsLiveSource*. 4.0.112
This commit is contained in:
parent
9b6a1b16e1
commit
2dd58665fa
29 changed files with 176 additions and 176 deletions
|
@ -176,6 +176,7 @@ The ports used by SRS:
|
|||
|
||||
## V4 changes
|
||||
|
||||
* v4.0, 2021-05-15, Rename SrsSource* to SrsLiveSource*. 4.0.112
|
||||
* v4.0, 2021-05-15, Rename SrsRtpPacket2 to SrsRtpPacket. 4.0.111
|
||||
* v4.0, 2021-05-14, RTC: Remove [Object Cache Pool](https://github.com/ossrs/srs/commit/14bfc98122bba369572417c19ebb2a61b373fc45#commitcomment-47655008), no effect. 4.0.110
|
||||
* v4.0, 2021-05-14, Change virtual public to public. 4.0.109
|
||||
|
|
|
@ -139,7 +139,7 @@ SrsRequest* SrsCoWorkers::find_stream_info(string vhost, string app, string stre
|
|||
return it->second;
|
||||
}
|
||||
|
||||
srs_error_t SrsCoWorkers::on_publish(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsCoWorkers::on_publish(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -157,7 +157,7 @@ srs_error_t SrsCoWorkers::on_publish(SrsSource* s, SrsRequest* r)
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsCoWorkers::on_unpublish(SrsSource* s, SrsRequest* r)
|
||||
void SrsCoWorkers::on_unpublish(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
string url = r->get_stream_url();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
class SrsJsonAny;
|
||||
class SrsRequest;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
|
||||
// For origin cluster.
|
||||
class SrsCoWorkers
|
||||
|
@ -50,8 +50,8 @@ public:
|
|||
private:
|
||||
virtual SrsRequest* find_stream_info(std::string vhost, std::string app, std::string stream);
|
||||
public:
|
||||
virtual srs_error_t on_publish(SrsSource* s, SrsRequest* r);
|
||||
virtual void on_unpublish(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t on_publish(SrsLiveSource* s, SrsRequest* r);
|
||||
virtual void on_unpublish(SrsLiveSource* s, SrsRequest* r);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsOriginHub;
|
||||
class SrsRequest;
|
||||
class SrsBuffer;
|
||||
|
|
|
@ -189,7 +189,7 @@ SrsEdgeIngester::~SrsEdgeIngester()
|
|||
srs_freep(trd);
|
||||
}
|
||||
|
||||
srs_error_t SrsEdgeIngester::initialize(SrsSource* s, SrsPlayEdge* e, SrsRequest* r)
|
||||
srs_error_t SrsEdgeIngester::initialize(SrsLiveSource* s, SrsPlayEdge* e, SrsRequest* r)
|
||||
{
|
||||
source = s;
|
||||
edge = e;
|
||||
|
@ -468,7 +468,7 @@ void SrsEdgeForwarder::set_queue_size(srs_utime_t queue_size)
|
|||
return queue->set_queue_size(queue_size);
|
||||
}
|
||||
|
||||
srs_error_t SrsEdgeForwarder::initialize(SrsSource* s, SrsPublishEdge* e, SrsRequest* r)
|
||||
srs_error_t SrsEdgeForwarder::initialize(SrsLiveSource* s, SrsPublishEdge* e, SrsRequest* r)
|
||||
{
|
||||
source = s;
|
||||
edge = e;
|
||||
|
@ -671,7 +671,7 @@ SrsPlayEdge::~SrsPlayEdge()
|
|||
srs_freep(ingester);
|
||||
}
|
||||
|
||||
srs_error_t SrsPlayEdge::initialize(SrsSource* source, SrsRequest* req)
|
||||
srs_error_t SrsPlayEdge::initialize(SrsLiveSource* source, SrsRequest* req)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -751,7 +751,7 @@ void SrsPublishEdge::set_queue_size(srs_utime_t queue_size)
|
|||
return forwarder->set_queue_size(queue_size);
|
||||
}
|
||||
|
||||
srs_error_t SrsPublishEdge::initialize(SrsSource* source, SrsRequest* req)
|
||||
srs_error_t SrsPublishEdge::initialize(SrsLiveSource* source, SrsRequest* req)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
class SrsStSocket;
|
||||
class SrsRtmpServer;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsRequest;
|
||||
class SrsPlayEdge;
|
||||
class SrsPublishEdge;
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
class SrsEdgeIngester : public ISrsCoroutineHandler
|
||||
{
|
||||
private:
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsPlayEdge* edge;
|
||||
SrsRequest* req;
|
||||
SrsCoroutine* trd;
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
SrsEdgeIngester();
|
||||
virtual ~SrsEdgeIngester();
|
||||
public:
|
||||
virtual srs_error_t initialize(SrsSource* s, SrsPlayEdge* e, SrsRequest* r);
|
||||
virtual srs_error_t initialize(SrsLiveSource* s, SrsPlayEdge* e, SrsRequest* r);
|
||||
virtual srs_error_t start();
|
||||
virtual void stop();
|
||||
virtual std::string get_curr_origin();
|
||||
|
@ -145,7 +145,7 @@ private:
|
|||
class SrsEdgeForwarder : public ISrsCoroutineHandler
|
||||
{
|
||||
private:
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsPublishEdge* edge;
|
||||
SrsRequest* req;
|
||||
SrsCoroutine* trd;
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
public:
|
||||
virtual void set_queue_size(srs_utime_t queue_size);
|
||||
public:
|
||||
virtual srs_error_t initialize(SrsSource* s, SrsPublishEdge* e, SrsRequest* r);
|
||||
virtual srs_error_t initialize(SrsLiveSource* s, SrsPublishEdge* e, SrsRequest* r);
|
||||
virtual srs_error_t start();
|
||||
virtual void stop();
|
||||
// Interface ISrsReusableThread2Handler
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
// Always use the req of source,
|
||||
// For we assume all client to edge is invalid,
|
||||
// if auth open, edge must valid it from origin, then service it.
|
||||
virtual srs_error_t initialize(SrsSource* source, SrsRequest* req);
|
||||
virtual srs_error_t initialize(SrsLiveSource* source, SrsRequest* req);
|
||||
// When client play stream on edge.
|
||||
virtual srs_error_t on_client_play();
|
||||
// When all client stopped play, disconnect to origin.
|
||||
|
@ -212,7 +212,7 @@ public:
|
|||
public:
|
||||
virtual void set_queue_size(srs_utime_t queue_size);
|
||||
public:
|
||||
virtual srs_error_t initialize(SrsSource* source, SrsRequest* req);
|
||||
virtual srs_error_t initialize(SrsLiveSource* source, SrsRequest* req);
|
||||
virtual bool can_publish();
|
||||
// When client publish stream on edge.
|
||||
virtual srs_error_t on_client_publish();
|
||||
|
|
|
@ -76,7 +76,7 @@ srs_error_t SrsForwarder::initialize(SrsRequest* r, string ep)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// it's ok to use the request object,
|
||||
// SrsSource already copy it and never delete it.
|
||||
// SrsLiveSource already copy it and never delete it.
|
||||
req = r;
|
||||
|
||||
// the ep(endpoint) to forward to
|
||||
|
|
|
@ -37,7 +37,7 @@ class SrsMessageQueue;
|
|||
class SrsRtmpJitter;
|
||||
class SrsRtmpClient;
|
||||
class SrsRequest;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsOriginHub;
|
||||
class SrsKbps;
|
||||
class SrsSimpleRtmpClient;
|
||||
|
|
|
@ -1432,7 +1432,7 @@ srs_error_t SrsGb28181RtmpMuxer::initialize(SrsServer *s, SrsRequest* r)
|
|||
req = r;
|
||||
server = s;
|
||||
|
||||
if ((err = _srs_sources->fetch_or_create(req, (ISrsSourceHandler*)server, &source)) != srs_success) {
|
||||
if ((err = _srs_sources->fetch_or_create(req, (ISrsLiveSourceHandler*)server, &source)) != srs_success) {
|
||||
return srs_error_wrap(err, "create source");
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class SrsGb28181StreamChannel;
|
|||
class SrsGb28181SipSession;
|
||||
class SrsRtpJitterBuffer;
|
||||
class SrsServer;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsRequest;
|
||||
class SrsResourceManager;
|
||||
class SrsGb28181Conn;
|
||||
|
@ -326,7 +326,7 @@ private:
|
|||
std::string aac_specific_config;
|
||||
|
||||
SrsRequest* req;
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsServer* server;
|
||||
|
||||
SrsRtpJitterBuffer *jitter_buffer;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
class SrsRequest;
|
||||
class SrsSharedPtrMessage;
|
||||
class SrsHdsFragment;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
|
||||
// Mux RTMP to Adobe HDS streaming.
|
||||
class SrsHds
|
||||
|
|
|
@ -41,7 +41,7 @@ class SrsRtmpJitter;
|
|||
class SrsTsContextWriter;
|
||||
class SrsRequest;
|
||||
class SrsPithyPrint;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsOriginHub;
|
||||
class SrsFileWriter;
|
||||
class SrsSimpleStream;
|
||||
|
|
|
@ -533,12 +533,12 @@ srs_error_t SrsHttpServer::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage
|
|||
return http_static->mux.serve_http(w, r);
|
||||
}
|
||||
|
||||
srs_error_t SrsHttpServer::http_mount(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsHttpServer::http_mount(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
return http_stream->http_mount(s, r);
|
||||
}
|
||||
|
||||
void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r)
|
||||
void SrsHttpServer::http_unmount(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
http_stream->http_unmount(s, r);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <srs_app_source.hpp>
|
||||
|
||||
class SrsServer;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsRequest;
|
||||
class SrsConsumer;
|
||||
class SrsStSocket;
|
||||
|
@ -208,8 +208,8 @@ public:
|
|||
public:
|
||||
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
||||
public:
|
||||
virtual srs_error_t http_mount(SrsSource* s, SrsRequest* r);
|
||||
virtual void http_unmount(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t http_mount(SrsLiveSource* s, SrsRequest* r);
|
||||
virtual void http_unmount(SrsLiveSource* s, SrsRequest* r);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -57,7 +57,7 @@ using namespace std;
|
|||
#include <srs_app_recv_thread.hpp>
|
||||
#include <srs_app_http_hooks.hpp>
|
||||
|
||||
SrsBufferCache::SrsBufferCache(SrsSource* s, SrsRequest* r)
|
||||
SrsBufferCache::SrsBufferCache(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
req = r->copy()->as_http();
|
||||
source = s;
|
||||
|
@ -76,7 +76,7 @@ SrsBufferCache::~SrsBufferCache()
|
|||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsBufferCache::update_auth(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsBufferCache::update_auth(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
srs_freep(req);
|
||||
req = r->copy();
|
||||
|
@ -104,7 +104,7 @@ srs_error_t SrsBufferCache::dump_cache(SrsConsumer* consumer, SrsRtmpJitterAlgor
|
|||
return err;
|
||||
}
|
||||
|
||||
// the jitter is get from SrsSource, which means the time_jitter of vhost.
|
||||
// the jitter is get from SrsLiveSource, which means the time_jitter of vhost.
|
||||
if ((err = queue->dump_packets(consumer, false, jitter)) != srs_success) {
|
||||
return srs_error_wrap(err, "dump packets");
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ srs_error_t SrsTsStreamEncoder::write_metadata(int64_t /*timestamp*/, char* /*da
|
|||
|
||||
bool SrsTsStreamEncoder::has_cache()
|
||||
{
|
||||
// for ts stream, use gop cache of SrsSource is ok.
|
||||
// for ts stream, use gop cache of SrsLiveSource is ok.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ srs_error_t SrsFlvStreamEncoder::write_metadata(int64_t timestamp, char* data, i
|
|||
|
||||
bool SrsFlvStreamEncoder::has_cache()
|
||||
{
|
||||
// for flv stream, use gop cache of SrsSource is ok.
|
||||
// for flv stream, use gop cache of SrsLiveSource is ok.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ srs_error_t SrsBufferWriter::writev(const iovec* iov, int iovcnt, ssize_t* pnwri
|
|||
return writer->writev(iov, iovcnt, pnwrite);
|
||||
}
|
||||
|
||||
SrsLiveStream::SrsLiveStream(SrsSource* s, SrsRequest* r, SrsBufferCache* c)
|
||||
SrsLiveStream::SrsLiveStream(SrsLiveSource* s, SrsRequest* r, SrsBufferCache* c)
|
||||
{
|
||||
source = s;
|
||||
cache = c;
|
||||
|
@ -527,7 +527,7 @@ SrsLiveStream::~SrsLiveStream()
|
|||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsLiveStream::update_auth(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsLiveStream::update_auth(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
source = s;
|
||||
|
||||
|
@ -893,7 +893,7 @@ srs_error_t SrsHttpStreamServer::initialize()
|
|||
}
|
||||
|
||||
// TODO: FIXME: rename for HTTP FLV mount.
|
||||
srs_error_t SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsHttpStreamServer::http_mount(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -967,7 +967,7 @@ srs_error_t SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r)
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsHttpStreamServer::http_unmount(SrsSource* s, SrsRequest* r)
|
||||
void SrsHttpStreamServer::http_unmount(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
std::string sid = r->get_stream_url();
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ srs_error_t SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost
|
|||
return srs_error_wrap(err, "init flv entry");
|
||||
}
|
||||
|
||||
// http mount need SrsRequest and SrsSource param, only create a mapping template entry
|
||||
// http mount need SrsRequest and SrsLiveSource param, only create a mapping template entry
|
||||
// and do mount automatically on playing http flv if this stream is a new http_remux stream.
|
||||
return err;
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ srs_error_t SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost
|
|||
continue;
|
||||
}
|
||||
|
||||
SrsSource* source = entry->source;
|
||||
SrsLiveSource* source = entry->source;
|
||||
if (_srs_config->get_vhost_http_remux_enabled(vhost)) {
|
||||
http_mount(source, req);
|
||||
} else {
|
||||
|
@ -1127,7 +1127,7 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle
|
|||
}
|
||||
}
|
||||
|
||||
SrsSource* s = NULL;
|
||||
SrsLiveSource* s = NULL;
|
||||
if ((err = _srs_sources->fetch_or_create(r, server, &s)) != srs_success) {
|
||||
return srs_error_wrap(err, "source create");
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ private:
|
|||
srs_utime_t fast_cache;
|
||||
private:
|
||||
SrsMessageQueue* queue;
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsRequest* req;
|
||||
SrsCoroutine* trd;
|
||||
public:
|
||||
SrsBufferCache(SrsSource* s, SrsRequest* r);
|
||||
SrsBufferCache(SrsLiveSource* s, SrsRequest* r);
|
||||
virtual ~SrsBufferCache();
|
||||
virtual srs_error_t update_auth(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t update_auth(SrsLiveSource* s, SrsRequest* r);
|
||||
public:
|
||||
virtual srs_error_t start();
|
||||
virtual srs_error_t dump_cache(SrsConsumer* consumer, SrsRtmpJitterAlgorithm jitter);
|
||||
|
@ -72,8 +72,8 @@ public:
|
|||
virtual srs_error_t write_metadata(int64_t timestamp, char* data, int size) = 0;
|
||||
public:
|
||||
// For some stream, for example, mp3 and aac, the audio stream,
|
||||
// we use large gop cache in encoder, for the gop cache of SrsSource is ignore audio.
|
||||
// @return true to use gop cache of encoder; otherwise, use SrsSource.
|
||||
// we use large gop cache in encoder, for the gop cache of SrsLiveSource is ignore audio.
|
||||
// @return true to use gop cache of encoder; otherwise, use SrsLiveSource.
|
||||
virtual bool has_cache() = 0;
|
||||
// Dumps the cache of encoder to consumer.
|
||||
virtual srs_error_t dump_cache(SrsConsumer* consumer, SrsRtmpJitterAlgorithm jitter) = 0;
|
||||
|
@ -184,12 +184,12 @@ class SrsLiveStream : public ISrsHttpHandler
|
|||
{
|
||||
private:
|
||||
SrsRequest* req;
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsBufferCache* cache;
|
||||
public:
|
||||
SrsLiveStream(SrsSource* s, SrsRequest* r, SrsBufferCache* c);
|
||||
SrsLiveStream(SrsLiveSource* s, SrsRequest* r, SrsBufferCache* c);
|
||||
virtual ~SrsLiveStream();
|
||||
virtual srs_error_t update_auth(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t update_auth(SrsLiveSource* s, SrsRequest* r);
|
||||
public:
|
||||
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
||||
private:
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
// We will free the request.
|
||||
SrsRequest* req;
|
||||
// Shared source.
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
public:
|
||||
// For template, the mount contains variables.
|
||||
// For concrete stream, the mount is url to access.
|
||||
|
@ -249,8 +249,8 @@ public:
|
|||
virtual srs_error_t initialize();
|
||||
public:
|
||||
// HTTP flv/ts/mp3/aac stream
|
||||
virtual srs_error_t http_mount(SrsSource* s, SrsRequest* r);
|
||||
virtual void http_unmount(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t http_mount(SrsLiveSource* s, SrsRequest* r);
|
||||
virtual void http_unmount(SrsLiveSource* s, SrsRequest* r);
|
||||
// Interface ISrsReloadHandler.
|
||||
public:
|
||||
virtual srs_error_t on_reload_vhost_added(std::string vhost);
|
||||
|
|
|
@ -278,7 +278,7 @@ void SrsQueueRecvThread::on_stop()
|
|||
}
|
||||
|
||||
SrsPublishRecvThread::SrsPublishRecvThread(SrsRtmpServer* rtmp_sdk, SrsRequest* _req,
|
||||
int mr_sock_fd, srs_utime_t tm, SrsRtmpConn* conn, SrsSource* source, SrsContextId parent_cid)
|
||||
int mr_sock_fd, srs_utime_t tm, SrsRtmpConn* conn, SrsLiveSource* source, SrsContextId parent_cid)
|
||||
: trd(this, rtmp_sdk, tm, parent_cid)
|
||||
{
|
||||
rtmp = rtmp_sdk;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
class SrsRtmpServer;
|
||||
class SrsCommonMessage;
|
||||
class SrsRtmpConn;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsRequest;
|
||||
class SrsConsumer;
|
||||
class SrsHttpConn;
|
||||
|
@ -164,7 +164,7 @@ private:
|
|||
srs_error_t recv_error;
|
||||
SrsRtmpConn* _conn;
|
||||
// The params for conn callback.
|
||||
SrsSource* _source;
|
||||
SrsLiveSource* _source;
|
||||
// The error timeout cond
|
||||
// @see https://github.com/ossrs/srs/issues/244
|
||||
srs_cond_t error;
|
||||
|
@ -173,7 +173,7 @@ private:
|
|||
SrsContextId ncid;
|
||||
public:
|
||||
SrsPublishRecvThread(SrsRtmpServer* rtmp_sdk, SrsRequest* _req,
|
||||
int mr_sock_fd, srs_utime_t tm, SrsRtmpConn* conn, SrsSource* source, SrsContextId parent_cid);
|
||||
int mr_sock_fd, srs_utime_t tm, SrsRtmpConn* conn, SrsLiveSource* source, SrsContextId parent_cid);
|
||||
virtual ~SrsPublishRecvThread();
|
||||
public:
|
||||
// Wait for error for some timeout.
|
||||
|
|
|
@ -1073,7 +1073,7 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcStreamDescripti
|
|||
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
||||
bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req->vhost);
|
||||
if (rtc_to_rtmp) {
|
||||
SrsSource *rtmp = NULL;
|
||||
SrsLiveSource *rtmp = NULL;
|
||||
if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), &rtmp)) != srs_success) {
|
||||
return srs_error_wrap(err, "create source");
|
||||
}
|
||||
|
|
|
@ -1231,7 +1231,7 @@ srs_error_t SrsRtcFromRtmpBridger::consume_packets(vector<SrsRtpPacket*>& pkts)
|
|||
return err;
|
||||
}
|
||||
|
||||
SrsRtmpFromRtcBridger::SrsRtmpFromRtcBridger(SrsSource *src)
|
||||
SrsRtmpFromRtcBridger::SrsRtmpFromRtcBridger(SrsLiveSource *src)
|
||||
{
|
||||
source_ = src;
|
||||
codec_ = NULL;
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
virtual void on_consumers_finished() = 0;
|
||||
};
|
||||
|
||||
// SrsRtcStream bridge to SrsSource
|
||||
// SrsRtcStream bridge to SrsLiveSource
|
||||
class ISrsRtcSourceBridger
|
||||
{
|
||||
public:
|
||||
|
@ -259,7 +259,7 @@ private:
|
|||
};
|
||||
|
||||
#ifdef SRS_FFMPEG_FIT
|
||||
class SrsRtcFromRtmpBridger : public ISrsSourceBridger
|
||||
class SrsRtcFromRtmpBridger : public ISrsLiveSourceBridger
|
||||
{
|
||||
private:
|
||||
SrsRequest* req;
|
||||
|
@ -302,7 +302,7 @@ private:
|
|||
class SrsRtmpFromRtcBridger : public ISrsRtcSourceBridger
|
||||
{
|
||||
private:
|
||||
SrsSource *source_;
|
||||
SrsLiveSource *source_;
|
||||
SrsAudioTranscoder *codec_;
|
||||
bool is_first_audio;
|
||||
bool is_first_video;
|
||||
|
@ -323,7 +323,7 @@ private:
|
|||
uint16_t lost_sn_;
|
||||
int64_t key_frame_ts_;
|
||||
public:
|
||||
SrsRtmpFromRtcBridger(SrsSource *src);
|
||||
SrsRtmpFromRtcBridger(SrsLiveSource *src);
|
||||
virtual ~SrsRtmpFromRtcBridger();
|
||||
public:
|
||||
srs_error_t initialize(SrsRequest* r);
|
||||
|
|
|
@ -526,7 +526,7 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
|
|||
rtmp->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT);
|
||||
|
||||
// find a source to serve.
|
||||
SrsSource* source = NULL;
|
||||
SrsLiveSource* source = NULL;
|
||||
if ((err = _srs_sources->fetch_or_create(req, server, &source)) != srs_success) {
|
||||
return srs_error_wrap(err, "rtmp: fetch source");
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ srs_error_t SrsRtmpConn::check_vhost(bool try_default_vhost)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::playing(SrsSource* source)
|
||||
srs_error_t SrsRtmpConn::playing(SrsLiveSource* source)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -709,7 +709,7 @@ srs_error_t SrsRtmpConn::playing(SrsSource* source)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRecvThread* rtrd)
|
||||
srs_error_t SrsRtmpConn::do_playing(SrsLiveSource* source, SrsConsumer* consumer, SrsQueueRecvThread* rtrd)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -836,7 +836,7 @@ srs_error_t SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, Sr
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::publishing(SrsSource* source)
|
||||
srs_error_t SrsRtmpConn::publishing(SrsLiveSource* source)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -875,7 +875,7 @@ srs_error_t SrsRtmpConn::publishing(SrsSource* source)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* rtrd)
|
||||
srs_error_t SrsRtmpConn::do_publishing(SrsLiveSource* source, SrsPublishRecvThread* rtrd)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -955,7 +955,7 @@ srs_error_t SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread*
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::acquire_publish(SrsSource* source)
|
||||
srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsSource* source)
|
|||
}
|
||||
}
|
||||
|
||||
void SrsRtmpConn::release_publish(SrsSource* source)
|
||||
void SrsRtmpConn::release_publish(SrsLiveSource* source)
|
||||
{
|
||||
// when edge, notice edge to change state.
|
||||
// when origin, notice all service to unpublish.
|
||||
|
@ -1014,7 +1014,7 @@ void SrsRtmpConn::release_publish(SrsSource* source)
|
|||
}
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::handle_publish_message(SrsSource* source, SrsCommonMessage* msg)
|
||||
srs_error_t SrsRtmpConn::handle_publish_message(SrsLiveSource* source, SrsCommonMessage* msg)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ srs_error_t SrsRtmpConn::handle_publish_message(SrsSource* source, SrsCommonMess
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpConn::process_publish_message(SrsSource* source, SrsCommonMessage* msg)
|
||||
srs_error_t SrsRtmpConn::process_publish_message(SrsLiveSource* source, SrsCommonMessage* msg)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class SrsServer;
|
|||
class SrsRtmpServer;
|
||||
class SrsRequest;
|
||||
class SrsResponse;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsRefer;
|
||||
class SrsConsumer;
|
||||
class SrsCommonMessage;
|
||||
|
@ -161,14 +161,14 @@ private:
|
|||
// The stream(play/publish) service cycle, identify client first.
|
||||
virtual srs_error_t stream_service_cycle();
|
||||
virtual srs_error_t check_vhost(bool try_default_vhost);
|
||||
virtual srs_error_t playing(SrsSource* source);
|
||||
virtual srs_error_t do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRecvThread* trd);
|
||||
virtual srs_error_t publishing(SrsSource* source);
|
||||
virtual srs_error_t do_publishing(SrsSource* source, SrsPublishRecvThread* trd);
|
||||
virtual srs_error_t acquire_publish(SrsSource* source);
|
||||
virtual void release_publish(SrsSource* source);
|
||||
virtual srs_error_t handle_publish_message(SrsSource* source, SrsCommonMessage* msg);
|
||||
virtual srs_error_t process_publish_message(SrsSource* source, SrsCommonMessage* msg);
|
||||
virtual srs_error_t playing(SrsLiveSource* source);
|
||||
virtual srs_error_t do_playing(SrsLiveSource* source, SrsConsumer* consumer, SrsQueueRecvThread* trd);
|
||||
virtual srs_error_t publishing(SrsLiveSource* source);
|
||||
virtual srs_error_t do_publishing(SrsLiveSource* source, SrsPublishRecvThread* trd);
|
||||
virtual srs_error_t acquire_publish(SrsLiveSource* source);
|
||||
virtual void release_publish(SrsLiveSource* source);
|
||||
virtual srs_error_t handle_publish_message(SrsLiveSource* source, SrsCommonMessage* msg);
|
||||
virtual srs_error_t process_publish_message(SrsLiveSource* source, SrsCommonMessage* msg);
|
||||
virtual srs_error_t process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg);
|
||||
virtual void set_sock_options();
|
||||
private:
|
||||
|
|
|
@ -1782,7 +1782,7 @@ srs_error_t SrsServer::on_reload_http_stream_updated()
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsServer::on_publish(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsServer::on_publish(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1798,7 +1798,7 @@ srs_error_t SrsServer::on_publish(SrsSource* s, SrsRequest* r)
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r)
|
||||
void SrsServer::on_unpublish(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
http_server->http_unmount(s, r);
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ public:
|
|||
|
||||
// TODO: FIXME: Rename to SrsLiveServer.
|
||||
// SRS RTMP server, initialize and listen, start connection service thread, destroy client.
|
||||
class SrsServer : public ISrsReloadHandler, public ISrsSourceHandler
|
||||
class SrsServer : public ISrsReloadHandler, public ISrsLiveSourceHandler
|
||||
, public ISrsResourceManager, public ISrsCoroutineHandler
|
||||
, public ISrsHourGlass
|
||||
{
|
||||
|
@ -393,10 +393,10 @@ public:
|
|||
virtual srs_error_t on_reload_http_stream_enabled();
|
||||
virtual srs_error_t on_reload_http_stream_disabled();
|
||||
virtual srs_error_t on_reload_http_stream_updated();
|
||||
// Interface ISrsSourceHandler
|
||||
// Interface ISrsLiveSourceHandler
|
||||
public:
|
||||
virtual srs_error_t on_publish(SrsSource* s, SrsRequest* r);
|
||||
virtual void on_unpublish(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t on_publish(SrsLiveSource* s, SrsRequest* r);
|
||||
virtual void on_unpublish(SrsLiveSource* s, SrsRequest* r);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -418,7 +418,7 @@ ISrsWakable::~ISrsWakable()
|
|||
{
|
||||
}
|
||||
|
||||
SrsConsumer::SrsConsumer(SrsSource* s)
|
||||
SrsConsumer::SrsConsumer(SrsLiveSource* s)
|
||||
{
|
||||
source = s;
|
||||
paused = false;
|
||||
|
@ -719,11 +719,11 @@ bool SrsGopCache::pure_audio()
|
|||
return cached_video_count == 0;
|
||||
}
|
||||
|
||||
ISrsSourceHandler::ISrsSourceHandler()
|
||||
ISrsLiveSourceHandler::ISrsLiveSourceHandler()
|
||||
{
|
||||
}
|
||||
|
||||
ISrsSourceHandler::~ISrsSourceHandler()
|
||||
ISrsLiveSourceHandler::~ISrsLiveSourceHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -861,7 +861,7 @@ SrsOriginHub::~SrsOriginHub()
|
|||
#endif
|
||||
}
|
||||
|
||||
srs_error_t SrsOriginHub::initialize(SrsSource* s, SrsRequest* r)
|
||||
srs_error_t SrsOriginHub::initialize(SrsLiveSource* s, SrsRequest* r)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1213,7 +1213,7 @@ srs_error_t SrsOriginHub::on_dvr_request_sh()
|
|||
|
||||
// feed the dvr the metadata/sequence header,
|
||||
// when reload to start dvr, dvr will never get the sequence header in stream,
|
||||
// use the SrsSource.on_dvr_request_sh to push the sequence header to DVR.
|
||||
// use the SrsLiveSource.on_dvr_request_sh to push the sequence header to DVR.
|
||||
if (cache_metadata && (err = dvr->on_meta_data(cache_metadata)) != srs_success) {
|
||||
return srs_error_wrap(err, "dvr metadata");
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ srs_error_t SrsOriginHub::on_reload_vhost_hls(string vhost)
|
|||
// when reload, we must fetch the sequence header from source cache.
|
||||
// notice the source to get the cached sequence header.
|
||||
// when reload to start hls, hls will never get the sequence header in stream,
|
||||
// use the SrsSource.on_hls_start to push the sequence header to HLS.
|
||||
// use the SrsLiveSource.on_hls_start to push the sequence header to HLS.
|
||||
SrsSharedPtrMessage* cache_sh_video = source->meta->vsh();
|
||||
if (cache_sh_video) {
|
||||
if ((err = format->on_video(cache_sh_video)) != srs_success) {
|
||||
|
@ -1684,26 +1684,26 @@ srs_error_t SrsMetaCache::update_vsh(SrsSharedPtrMessage* msg)
|
|||
return vformat->on_video(msg);
|
||||
}
|
||||
|
||||
SrsSourceManager* _srs_sources = NULL;
|
||||
SrsLiveSourceManager* _srs_sources = NULL;
|
||||
|
||||
SrsSourceManager::SrsSourceManager()
|
||||
SrsLiveSourceManager::SrsLiveSourceManager()
|
||||
{
|
||||
lock = srs_mutex_new();
|
||||
timer_ = new SrsHourGlass("sources", this, 1 * SRS_UTIME_SECONDS);
|
||||
}
|
||||
|
||||
SrsSourceManager::~SrsSourceManager()
|
||||
SrsLiveSourceManager::~SrsLiveSourceManager()
|
||||
{
|
||||
srs_mutex_destroy(lock);
|
||||
srs_freep(timer_);
|
||||
}
|
||||
|
||||
srs_error_t SrsSourceManager::initialize()
|
||||
srs_error_t SrsLiveSourceManager::initialize()
|
||||
{
|
||||
return setup_ticks();
|
||||
}
|
||||
|
||||
srs_error_t SrsSourceManager::fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, SrsSource** pps)
|
||||
srs_error_t SrsLiveSourceManager::fetch_or_create(SrsRequest* r, ISrsLiveSourceHandler* h, SrsLiveSource** pps)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1712,7 +1712,7 @@ srs_error_t SrsSourceManager::fetch_or_create(SrsRequest* r, ISrsSourceHandler*
|
|||
// TODO: FIXME: Use smaller lock.
|
||||
SrsLocker(lock);
|
||||
|
||||
SrsSource* source = NULL;
|
||||
SrsLiveSource* source = NULL;
|
||||
if ((source = fetch(r)) != NULL) {
|
||||
*pps = source;
|
||||
return err;
|
||||
|
@ -1726,7 +1726,7 @@ srs_error_t SrsSourceManager::fetch_or_create(SrsRequest* r, ISrsSourceHandler*
|
|||
|
||||
srs_trace("new source, stream_url=%s", stream_url.c_str());
|
||||
|
||||
source = new SrsSource();
|
||||
source = new SrsLiveSource();
|
||||
if ((err = source->initialize(r, h)) != srs_success) {
|
||||
err = srs_error_wrap(err, "init source %s", r->get_stream_url().c_str());
|
||||
goto failed;
|
||||
|
@ -1741,9 +1741,9 @@ failed:
|
|||
return err;
|
||||
}
|
||||
|
||||
SrsSource* SrsSourceManager::fetch(SrsRequest* r)
|
||||
SrsLiveSource* SrsLiveSourceManager::fetch(SrsRequest* r)
|
||||
{
|
||||
SrsSource* source = NULL;
|
||||
SrsLiveSource* source = NULL;
|
||||
|
||||
string stream_url = r->get_stream_url();
|
||||
if (pool.find(stream_url) == pool.end()) {
|
||||
|
@ -1760,17 +1760,17 @@ SrsSource* SrsSourceManager::fetch(SrsRequest* r)
|
|||
return source;
|
||||
}
|
||||
|
||||
void SrsSourceManager::dispose()
|
||||
void SrsLiveSourceManager::dispose()
|
||||
{
|
||||
std::map<std::string, SrsSource*>::iterator it;
|
||||
std::map<std::string, SrsLiveSource*>::iterator it;
|
||||
for (it = pool.begin(); it != pool.end(); ++it) {
|
||||
SrsSource* source = it->second;
|
||||
SrsLiveSource* source = it->second;
|
||||
source->dispose();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
srs_error_t SrsSourceManager::setup_ticks()
|
||||
srs_error_t SrsLiveSourceManager::setup_ticks()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1785,13 +1785,13 @@ srs_error_t SrsSourceManager::setup_ticks()
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSourceManager::notify(int event, srs_utime_t interval, srs_utime_t tick)
|
||||
srs_error_t SrsLiveSourceManager::notify(int event, srs_utime_t interval, srs_utime_t tick)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
std::map<std::string, SrsSource*>::iterator it;
|
||||
std::map<std::string, SrsLiveSource*>::iterator it;
|
||||
for (it = pool.begin(); it != pool.end();) {
|
||||
SrsSource* source = it->second;
|
||||
SrsLiveSource* source = it->second;
|
||||
|
||||
// Do cycle source to cleanup components, such as hls dispose.
|
||||
if ((err = source->cycle()) != srs_success) {
|
||||
|
@ -1826,25 +1826,25 @@ srs_error_t SrsSourceManager::notify(int event, srs_utime_t interval, srs_utime_
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsSourceManager::destroy()
|
||||
void SrsLiveSourceManager::destroy()
|
||||
{
|
||||
std::map<std::string, SrsSource*>::iterator it;
|
||||
std::map<std::string, SrsLiveSource*>::iterator it;
|
||||
for (it = pool.begin(); it != pool.end(); ++it) {
|
||||
SrsSource* source = it->second;
|
||||
SrsLiveSource* source = it->second;
|
||||
srs_freep(source);
|
||||
}
|
||||
pool.clear();
|
||||
}
|
||||
|
||||
ISrsSourceBridger::ISrsSourceBridger()
|
||||
ISrsLiveSourceBridger::ISrsLiveSourceBridger()
|
||||
{
|
||||
}
|
||||
|
||||
ISrsSourceBridger::~ISrsSourceBridger()
|
||||
ISrsLiveSourceBridger::~ISrsLiveSourceBridger()
|
||||
{
|
||||
}
|
||||
|
||||
SrsSource::SrsSource()
|
||||
SrsLiveSource::SrsLiveSource()
|
||||
{
|
||||
req = NULL;
|
||||
jitter_algorithm = SrsRtmpJitterAlgorithmOFF;
|
||||
|
@ -1870,7 +1870,7 @@ SrsSource::SrsSource()
|
|||
atc = false;
|
||||
}
|
||||
|
||||
SrsSource::~SrsSource()
|
||||
SrsLiveSource::~SrsLiveSource()
|
||||
{
|
||||
_srs_config->unsubscribe(this);
|
||||
|
||||
|
@ -1890,14 +1890,14 @@ SrsSource::~SrsSource()
|
|||
srs_freep(bridger_);
|
||||
}
|
||||
|
||||
void SrsSource::dispose()
|
||||
void SrsLiveSource::dispose()
|
||||
{
|
||||
hub->dispose();
|
||||
meta->dispose();
|
||||
gop_cache->dispose();
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::cycle()
|
||||
srs_error_t SrsLiveSource::cycle()
|
||||
{
|
||||
srs_error_t err = hub->cycle();
|
||||
if (err != srs_success) {
|
||||
|
@ -1907,7 +1907,7 @@ srs_error_t SrsSource::cycle()
|
|||
return srs_success;
|
||||
}
|
||||
|
||||
bool SrsSource::expired()
|
||||
bool SrsLiveSource::expired()
|
||||
{
|
||||
// unknown state?
|
||||
if (die_at == 0) {
|
||||
|
@ -1932,7 +1932,7 @@ bool SrsSource::expired()
|
|||
return false;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h)
|
||||
srs_error_t SrsLiveSource::initialize(SrsRequest* r, ISrsLiveSourceHandler* h)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -1963,13 +1963,13 @@ srs_error_t SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h)
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsSource::set_bridger(ISrsSourceBridger* v)
|
||||
void SrsLiveSource::set_bridger(ISrsLiveSourceBridger* v)
|
||||
{
|
||||
srs_freep(bridger_);
|
||||
bridger_ = v;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_reload_vhost_play(string vhost)
|
||||
srs_error_t SrsLiveSource::on_reload_vhost_play(string vhost)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2052,7 +2052,7 @@ srs_error_t SrsSource::on_reload_vhost_play(string vhost)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_source_id_changed(SrsContextId id)
|
||||
srs_error_t SrsLiveSource::on_source_id_changed(SrsContextId id)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2075,27 +2075,27 @@ srs_error_t SrsSource::on_source_id_changed(SrsContextId id)
|
|||
return err;
|
||||
}
|
||||
|
||||
SrsContextId SrsSource::source_id()
|
||||
SrsContextId SrsLiveSource::source_id()
|
||||
{
|
||||
return _source_id;
|
||||
}
|
||||
|
||||
SrsContextId SrsSource::pre_source_id()
|
||||
SrsContextId SrsLiveSource::pre_source_id()
|
||||
{
|
||||
return _pre_source_id;
|
||||
}
|
||||
|
||||
bool SrsSource::inactive()
|
||||
bool SrsLiveSource::inactive()
|
||||
{
|
||||
return _can_publish;
|
||||
}
|
||||
|
||||
void SrsSource::update_auth(SrsRequest* r)
|
||||
void SrsLiveSource::update_auth(SrsRequest* r)
|
||||
{
|
||||
req->update_auth(r);
|
||||
}
|
||||
|
||||
bool SrsSource::can_publish(bool is_edge)
|
||||
bool SrsLiveSource::can_publish(bool is_edge)
|
||||
{
|
||||
// TODO: FIXME: Should check the status of bridger.
|
||||
|
||||
|
@ -2106,7 +2106,7 @@ bool SrsSource::can_publish(bool is_edge)
|
|||
return _can_publish;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata)
|
||||
srs_error_t SrsLiveSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2152,7 +2152,7 @@ srs_error_t SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket*
|
|||
return hub->on_meta_data(meta->data(), metadata);
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_audio(SrsCommonMessage* shared_audio)
|
||||
srs_error_t SrsLiveSource::on_audio(SrsCommonMessage* shared_audio)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2197,7 +2197,7 @@ srs_error_t SrsSource::on_audio(SrsCommonMessage* shared_audio)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
|
||||
srs_error_t SrsLiveSource::on_audio_imp(SrsSharedPtrMessage* msg)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2265,7 +2265,7 @@ srs_error_t SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_video(SrsCommonMessage* shared_video)
|
||||
srs_error_t SrsLiveSource::on_video(SrsCommonMessage* shared_video)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2322,7 +2322,7 @@ srs_error_t SrsSource::on_video(SrsCommonMessage* shared_video)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
||||
srs_error_t SrsLiveSource::on_video_imp(SrsSharedPtrMessage* msg)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2386,7 +2386,7 @@ srs_error_t SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_aggregate(SrsCommonMessage* msg)
|
||||
srs_error_t SrsLiveSource::on_aggregate(SrsCommonMessage* msg)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2476,7 +2476,7 @@ srs_error_t SrsSource::on_aggregate(SrsCommonMessage* msg)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_publish()
|
||||
srs_error_t SrsLiveSource::on_publish()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2523,7 +2523,7 @@ srs_error_t SrsSource::on_publish()
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsSource::on_unpublish()
|
||||
void SrsLiveSource::on_unpublish()
|
||||
{
|
||||
// ignore when already unpublished.
|
||||
if (_can_publish) {
|
||||
|
@ -2569,7 +2569,7 @@ void SrsSource::on_unpublish()
|
|||
}
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::create_consumer(SrsConsumer*& consumer)
|
||||
srs_error_t SrsLiveSource::create_consumer(SrsConsumer*& consumer)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2587,7 +2587,7 @@ srs_error_t SrsSource::create_consumer(SrsConsumer*& consumer)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::consumer_dumps(SrsConsumer* consumer, bool ds, bool dm, bool dg)
|
||||
srs_error_t SrsLiveSource::consumer_dumps(SrsConsumer* consumer, bool ds, bool dm, bool dg)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2630,7 +2630,7 @@ srs_error_t SrsSource::consumer_dumps(SrsConsumer* consumer, bool ds, bool dm, b
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsSource::on_consumer_destroy(SrsConsumer* consumer)
|
||||
void SrsLiveSource::on_consumer_destroy(SrsConsumer* consumer)
|
||||
{
|
||||
std::vector<SrsConsumer*>::iterator it;
|
||||
it = std::find(consumers.begin(), consumers.end(), consumer);
|
||||
|
@ -2644,33 +2644,33 @@ void SrsSource::on_consumer_destroy(SrsConsumer* consumer)
|
|||
}
|
||||
}
|
||||
|
||||
void SrsSource::set_cache(bool enabled)
|
||||
void SrsLiveSource::set_cache(bool enabled)
|
||||
{
|
||||
gop_cache->set(enabled);
|
||||
}
|
||||
|
||||
SrsRtmpJitterAlgorithm SrsSource::jitter()
|
||||
SrsRtmpJitterAlgorithm SrsLiveSource::jitter()
|
||||
{
|
||||
return jitter_algorithm;
|
||||
}
|
||||
|
||||
srs_error_t SrsSource::on_edge_start_publish()
|
||||
srs_error_t SrsLiveSource::on_edge_start_publish()
|
||||
{
|
||||
return publish_edge->on_client_publish();
|
||||
}
|
||||
|
||||
// TODO: FIXME: Use edge strategy pattern.
|
||||
srs_error_t SrsSource::on_edge_proxy_publish(SrsCommonMessage* msg)
|
||||
srs_error_t SrsLiveSource::on_edge_proxy_publish(SrsCommonMessage* msg)
|
||||
{
|
||||
return publish_edge->on_proxy_publish(msg);
|
||||
}
|
||||
|
||||
void SrsSource::on_edge_proxy_unpublish()
|
||||
void SrsLiveSource::on_edge_proxy_unpublish()
|
||||
{
|
||||
publish_edge->on_proxy_unpublish();
|
||||
}
|
||||
|
||||
string SrsSource::get_curr_origin()
|
||||
string SrsLiveSource::get_curr_origin()
|
||||
{
|
||||
return play_edge->get_curr_origin();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class SrsRtmpFormat;
|
|||
class SrsConsumer;
|
||||
class SrsPlayEdge;
|
||||
class SrsPublishEdge;
|
||||
class SrsSource;
|
||||
class SrsLiveSource;
|
||||
class SrsCommonMessage;
|
||||
class SrsOnMetaDataPacket;
|
||||
class SrsSharedPtrMessage;
|
||||
|
@ -182,12 +182,12 @@ public:
|
|||
virtual void wakeup() = 0;
|
||||
};
|
||||
|
||||
// The consumer for SrsSource, that is a play client.
|
||||
// The consumer for SrsLiveSource, that is a play client.
|
||||
class SrsConsumer : public ISrsWakable
|
||||
{
|
||||
private:
|
||||
SrsRtmpJitter* jitter;
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsMessageQueue* queue;
|
||||
bool paused;
|
||||
// when source id changed, notice all consumers
|
||||
|
@ -201,7 +201,7 @@ private:
|
|||
srs_utime_t mw_duration;
|
||||
#endif
|
||||
public:
|
||||
SrsConsumer(SrsSource* s);
|
||||
SrsConsumer(SrsLiveSource* s);
|
||||
virtual ~SrsConsumer();
|
||||
public:
|
||||
// Set the size of queue.
|
||||
|
@ -294,16 +294,16 @@ public:
|
|||
// The handler to handle the event of srs source.
|
||||
// For example, the http flv streaming module handle the event and
|
||||
// mount http when rtmp start publishing.
|
||||
class ISrsSourceHandler
|
||||
class ISrsLiveSourceHandler
|
||||
{
|
||||
public:
|
||||
ISrsSourceHandler();
|
||||
virtual ~ISrsSourceHandler();
|
||||
ISrsLiveSourceHandler();
|
||||
virtual ~ISrsLiveSourceHandler();
|
||||
public:
|
||||
// when stream start publish, mount stream.
|
||||
virtual srs_error_t on_publish(SrsSource* s, SrsRequest* r) = 0;
|
||||
virtual srs_error_t on_publish(SrsLiveSource* s, SrsRequest* r) = 0;
|
||||
// when stream stop publish, unmount stream.
|
||||
virtual void on_unpublish(SrsSource* s, SrsRequest* r) = 0;
|
||||
virtual void on_unpublish(SrsLiveSource* s, SrsRequest* r) = 0;
|
||||
};
|
||||
|
||||
// The mix queue to correct the timestamp for mix_correct algorithm.
|
||||
|
@ -328,7 +328,7 @@ public:
|
|||
class SrsOriginHub : public ISrsReloadHandler
|
||||
{
|
||||
private:
|
||||
SrsSource* source;
|
||||
SrsLiveSource* source;
|
||||
SrsRequest* req;
|
||||
bool is_active;
|
||||
private:
|
||||
|
@ -356,7 +356,7 @@ public:
|
|||
public:
|
||||
// Initialize the hub with source and request.
|
||||
// @param r The request object, managed by source.
|
||||
virtual srs_error_t initialize(SrsSource* s, SrsRequest* r);
|
||||
virtual srs_error_t initialize(SrsLiveSource* s, SrsRequest* r);
|
||||
// Dispose the hub, release utilities resource,
|
||||
// For example, delete all HLS pieces.
|
||||
virtual void dispose();
|
||||
|
@ -451,26 +451,26 @@ public:
|
|||
};
|
||||
|
||||
// The source manager to create and refresh all stream sources.
|
||||
class SrsSourceManager : public ISrsHourGlass
|
||||
class SrsLiveSourceManager : public ISrsHourGlass
|
||||
{
|
||||
private:
|
||||
srs_mutex_t lock;
|
||||
std::map<std::string, SrsSource*> pool;
|
||||
std::map<std::string, SrsLiveSource*> pool;
|
||||
SrsHourGlass* timer_;
|
||||
public:
|
||||
SrsSourceManager();
|
||||
virtual ~SrsSourceManager();
|
||||
SrsLiveSourceManager();
|
||||
virtual ~SrsLiveSourceManager();
|
||||
public:
|
||||
virtual srs_error_t initialize();
|
||||
// create source when fetch from cache failed.
|
||||
// @param r the client request.
|
||||
// @param h the event handler for source.
|
||||
// @param pps the matched source, if success never be NULL.
|
||||
virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, SrsSource** pps);
|
||||
virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsLiveSourceHandler* h, SrsLiveSource** pps);
|
||||
private:
|
||||
// Get the exists source, NULL when not exists.
|
||||
// update the request and return the exists source.
|
||||
virtual SrsSource* fetch(SrsRequest* r);
|
||||
virtual SrsLiveSource* fetch(SrsRequest* r);
|
||||
public:
|
||||
// dispose and cycle all sources.
|
||||
virtual void dispose();
|
||||
|
@ -485,14 +485,14 @@ public:
|
|||
};
|
||||
|
||||
// Global singleton instance.
|
||||
extern SrsSourceManager* _srs_sources;
|
||||
extern SrsLiveSourceManager* _srs_sources;
|
||||
|
||||
// For RTMP2RTC, bridge SrsSource to SrsRtcStream
|
||||
class ISrsSourceBridger
|
||||
// For RTMP2RTC, bridge SrsLiveSource to SrsRtcStream
|
||||
class ISrsLiveSourceBridger
|
||||
{
|
||||
public:
|
||||
ISrsSourceBridger();
|
||||
virtual ~ISrsSourceBridger();
|
||||
ISrsLiveSourceBridger();
|
||||
virtual ~ISrsLiveSourceBridger();
|
||||
public:
|
||||
virtual srs_error_t on_publish() = 0;
|
||||
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio) = 0;
|
||||
|
@ -501,8 +501,7 @@ public:
|
|||
};
|
||||
|
||||
// The live streaming source.
|
||||
// TODO: FIXME: Rename to SrsLiveStream.
|
||||
class SrsSource : public ISrsReloadHandler
|
||||
class SrsLiveSource : public ISrsReloadHandler
|
||||
{
|
||||
friend class SrsOriginHub;
|
||||
private:
|
||||
|
@ -533,9 +532,9 @@ private:
|
|||
// The time of the packet we just got.
|
||||
int64_t last_packet_time;
|
||||
// The event handler.
|
||||
ISrsSourceHandler* handler;
|
||||
ISrsLiveSourceHandler* handler;
|
||||
// The source bridger for other source.
|
||||
ISrsSourceBridger* bridger_;
|
||||
ISrsLiveSourceBridger* bridger_;
|
||||
// The edge control service
|
||||
SrsPlayEdge* play_edge;
|
||||
SrsPublishEdge* publish_edge;
|
||||
|
@ -552,8 +551,8 @@ private:
|
|||
// We will remove the source when source die.
|
||||
srs_utime_t die_at;
|
||||
public:
|
||||
SrsSource();
|
||||
virtual ~SrsSource();
|
||||
SrsLiveSource();
|
||||
virtual ~SrsLiveSource();
|
||||
public:
|
||||
virtual void dispose();
|
||||
virtual srs_error_t cycle();
|
||||
|
@ -561,9 +560,9 @@ public:
|
|||
virtual bool expired();
|
||||
public:
|
||||
// Initialize the hls with handlers.
|
||||
virtual srs_error_t initialize(SrsRequest* r, ISrsSourceHandler* h);
|
||||
virtual srs_error_t initialize(SrsRequest* r, ISrsLiveSourceHandler* h);
|
||||
// Bridge to other source, forward packets to it.
|
||||
void set_bridger(ISrsSourceBridger* v);
|
||||
void set_bridger(ISrsLiveSourceBridger* v);
|
||||
// Interface ISrsReloadHandler
|
||||
public:
|
||||
virtual srs_error_t on_reload_vhost_play(std::string vhost);
|
||||
|
|
|
@ -292,7 +292,7 @@ srs_error_t srs_thread_initialize()
|
|||
// The global objects which depends on ST.
|
||||
_srs_hybrid = new SrsHybridServer();
|
||||
_srs_rtc_sources = new SrsRtcStreamManager();
|
||||
_srs_sources = new SrsSourceManager();
|
||||
_srs_sources = new SrsLiveSourceManager();
|
||||
_srs_stages = new SrsStageManager();
|
||||
_srs_blackhole = new SrsRtcBlackhole();
|
||||
_srs_rtc_manager = new SrsResourceManager("RTC", true);
|
||||
|
|
|
@ -26,6 +26,6 @@
|
|||
|
||||
#define VERSION_MAJOR 4
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 111
|
||||
#define VERSION_REVISION 112
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue