LiveSource/RtcSource: Refine fetch for external exposed interface. (#2873)

pull/2872/head
chundonglinlin 3 years ago committed by GitHub
parent 71a4b3c3f7
commit 7580341a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -256,6 +256,10 @@ srs_error_t SrsRtcSourceManager::fetch_or_create(SrsRequest* r, SrsRtcSource** p
SrsRtcSource* source = NULL; SrsRtcSource* source = NULL;
if ((source = fetch(r)) != NULL) { if ((source = fetch(r)) != NULL) {
// 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);
*pps = source; *pps = source;
return err; return err;
} }
@ -291,11 +295,6 @@ SrsRtcSource* SrsRtcSourceManager::fetch(SrsRequest* r)
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; return source;
} }

@ -114,7 +114,6 @@ public:
virtual srs_error_t fetch_or_create(SrsRequest* r, SrsRtcSource** pps); virtual srs_error_t fetch_or_create(SrsRequest* r, SrsRtcSource** 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.
virtual SrsRtcSource* fetch(SrsRequest* r); virtual SrsRtcSource* fetch(SrsRequest* r);
}; };

@ -1713,6 +1713,10 @@ srs_error_t SrsLiveSourceManager::fetch_or_create(SrsRequest* r, ISrsLiveSourceH
SrsLiveSource* source = NULL; SrsLiveSource* source = NULL;
if ((source = fetch(r)) != NULL) { if ((source = fetch(r)) != NULL) {
// 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);
*pps = source; *pps = source;
return err; return err;
} }
@ -1751,11 +1755,6 @@ SrsLiveSource* SrsLiveSourceManager::fetch(SrsRequest* r)
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; return source;
} }

@ -450,7 +450,6 @@ public:
virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsLiveSourceHandler* h, SrsLiveSource** pps); virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsLiveSourceHandler* h, SrsLiveSource** pps);
public: public:
// Get the exists source, NULL when not exists. // Get the exists source, NULL when not exists.
// update the request and return the exists source.
virtual SrsLiveSource* fetch(SrsRequest* r); virtual SrsLiveSource* fetch(SrsRequest* r);
public: public:
// dispose and cycle all sources. // dispose and cycle all sources.

Loading…
Cancel
Save