mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
merge srs2
This commit is contained in:
commit
9ba4bed648
5 changed files with 19 additions and 32 deletions
|
@ -737,17 +737,23 @@ ISrsSourceHandler::~ISrsSourceHandler()
|
|||
|
||||
std::map<std::string, SrsSource*> SrsSource::pool;
|
||||
|
||||
int SrsSource::create(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh, SrsSource** pps)
|
||||
int SrsSource::fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh, SrsSource** pps)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
SrsSource* source = NULL;
|
||||
if ((source = fetch(r)) != NULL) {
|
||||
*pps = source;
|
||||
return ret;
|
||||
}
|
||||
|
||||
string stream_url = r->get_stream_url();
|
||||
string vhost = r->vhost;
|
||||
|
||||
// should always not exists for create a source.
|
||||
srs_assert (pool.find(stream_url) == pool.end());
|
||||
|
||||
SrsSource* source = new SrsSource();
|
||||
source = new SrsSource();
|
||||
if ((ret = source->initialize(r, h, hh)) != ERROR_SUCCESS) {
|
||||
srs_freep(source);
|
||||
return ret;
|
||||
|
@ -780,20 +786,6 @@ SrsSource* SrsSource::fetch(SrsRequest* r)
|
|||
return source;
|
||||
}
|
||||
|
||||
SrsSource* SrsSource::fetch(std::string vhost, std::string app, std::string stream)
|
||||
{
|
||||
SrsSource* source = NULL;
|
||||
string stream_url = srs_generate_stream_url(vhost, app, stream);
|
||||
|
||||
if (pool.find(stream_url) == pool.end()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
source = pool[stream_url];
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
void SrsSource::dispose_all()
|
||||
{
|
||||
std::map<std::string, SrsSource*>::iterator it;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue