Skip to content

Commit

Permalink
LiveSource: Refine fetch for external exposed interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
chundonglinlin committed Jan 12, 2022
1 parent c30aa47 commit 2f41775
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
13 changes: 4 additions & 9 deletions trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ srs_error_t SrsRtcSourceManager::fetch_or_create(SrsRequest* r, SrsRtcSource** p

SrsRtcSource* source = NULL;
if ((source = fetch(r)) != NULL) {
// update requst
source->update_auth(r);
*pps = source;
return err;
}
Expand Down Expand Up @@ -285,17 +287,10 @@ SrsRtcSource* SrsRtcSourceManager::fetch(SrsRequest* r)
SrsRtcSource* source = NULL;

string stream_url = r->get_stream_url();
if (pool.find(stream_url) == pool.end()) {
return NULL;
if (pool.find(stream_url) != pool.end()) {
source = pool[stream_url];
}

source = pool[stream_url];

// we always update the request of resource,
// for origin auth is on, the token in request maybe invalid,
// and we only need to update the token of request, it's simple.
source->update_auth(r);

return source;
}

Expand Down
15 changes: 5 additions & 10 deletions trunk/src/app/srs_app_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,8 @@ srs_error_t SrsLiveSourceManager::fetch_or_create(SrsRequest* r, ISrsLiveSourceH

SrsLiveSource* source = NULL;
if ((source = fetch(r)) != NULL) {
// update request
source->update_auth(r);
*pps = source;
return err;
}
Expand Down Expand Up @@ -1745,17 +1747,10 @@ SrsLiveSource* SrsLiveSourceManager::fetch(SrsRequest* r)
SrsLiveSource* source = NULL;

string stream_url = r->get_stream_url();
if (pool.find(stream_url) == pool.end()) {
return NULL;
if (pool.find(stream_url) != pool.end()) {
source = pool[stream_url];
}

source = pool[stream_url];

// we always update the request of resource,
// for origin auth is on, the token in request maybe invalid,
// and we only need to update the token of request, it's simple.
source->update_auth(r);


return source;
}

Expand Down

0 comments on commit 2f41775

Please sign in to comment.