1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

SmartPtr: Support shared ptr for SRT source. (#4084)

---

Co-authored-by: Haibo Chen <495810242@qq.com>
This commit is contained in:
Winlin 2024-06-13 14:44:09 +08:00 committed by GitHub
parent 6834ec208d
commit 7b9c52b283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 42 additions and 36 deletions

View file

@ -15,6 +15,7 @@
#include <srs_kernel_ts.hpp>
#include <srs_protocol_st.hpp>
#include <srs_app_stream_bridge.hpp>
#include <srs_core_autofree.hpp>
class SrsSharedPtrMessage;
class SrsRequest;
@ -50,7 +51,7 @@ class SrsSrtSourceManager
{
private:
srs_mutex_t lock;
std::map<std::string, SrsSrtSource*> pool;
std::map< std::string, SrsSharedPtr<SrsSrtSource> > pool;
public:
SrsSrtSourceManager();
virtual ~SrsSrtSourceManager();
@ -58,10 +59,9 @@ public:
// create source when fetch from cache failed.
// @param r the client request.
// @param pps the matched source, if success never be NULL.
virtual srs_error_t fetch_or_create(SrsRequest* r, SrsSrtSource** pps);
public:
// Get the exists source, NULL when not exists.
virtual SrsSrtSource* fetch(SrsRequest* r);
virtual srs_error_t fetch_or_create(SrsRequest* r, SrsSharedPtr<SrsSrtSource>& pps);
// Dispose and destroy the source.
virtual void eliminate(SrsRequest* r);
};
// Global singleton instance.