mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
改为按 Session 查找媒体源以支持 TCP/UDP Session
This commit is contained in:
parent
0d48275115
commit
ece7186e6c
@ -280,7 +280,7 @@ static MediaSource::Ptr find_l(const string &schema, const string &vhost_in, con
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void findAsync_l(const MediaInfo &info, const std::shared_ptr<TcpSession> &session, bool retry,
|
static void findAsync_l(const MediaInfo &info, const std::shared_ptr<Session> &session, bool retry,
|
||||||
const function<void(const MediaSource::Ptr &src)> &cb){
|
const function<void(const MediaSource::Ptr &src)> &cb){
|
||||||
auto src = find_l(info._schema, info._vhost, info._app, info._streamid, true);
|
auto src = find_l(info._schema, info._vhost, info._app, info._streamid, true);
|
||||||
if (src || !retry) {
|
if (src || !retry) {
|
||||||
@ -314,7 +314,7 @@ static void findAsync_l(const MediaInfo &info, const std::shared_ptr<TcpSession>
|
|||||||
NoticeCenter::Instance().delListener(listener_tag, Broadcast::kBroadcastMediaChanged);
|
NoticeCenter::Instance().delListener(listener_tag, Broadcast::kBroadcastMediaChanged);
|
||||||
};
|
};
|
||||||
|
|
||||||
weak_ptr<TcpSession> weak_session = session;
|
weak_ptr<Session> weak_session = session;
|
||||||
auto on_register = [weak_session, info, cb_once, cancel_all, poller](BroadcastMediaChangedArgs) {
|
auto on_register = [weak_session, info, cb_once, cancel_all, poller](BroadcastMediaChangedArgs) {
|
||||||
if (!bRegist ||
|
if (!bRegist ||
|
||||||
sender.getSchema() != info._schema ||
|
sender.getSchema() != info._schema ||
|
||||||
@ -352,7 +352,7 @@ static void findAsync_l(const MediaInfo &info, const std::shared_ptr<TcpSession>
|
|||||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastNotFoundStream, info, static_cast<SockInfo &>(*session), close_player);
|
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastNotFoundStream, info, static_cast<SockInfo &>(*session), close_player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaSource::findAsync(const MediaInfo &info, const std::shared_ptr<TcpSession> &session,const function<void(const Ptr &src)> &cb){
|
void MediaSource::findAsync(const MediaInfo &info, const std::shared_ptr<Session> &session, const function<void (const Ptr &)> &cb) {
|
||||||
return findAsync_l(info, session, true, cb);
|
return findAsync_l(info, session, true, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ using namespace std;
|
|||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
|
||||||
namespace toolkit{
|
namespace toolkit{
|
||||||
class TcpSession;
|
class Session;
|
||||||
}// namespace toolkit
|
}// namespace toolkit
|
||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
@ -271,7 +271,7 @@ public:
|
|||||||
static Ptr find(const string &vhost, const string &app, const string &stream_id);
|
static Ptr find(const string &vhost, const string &app, const string &stream_id);
|
||||||
|
|
||||||
// 异步查找流
|
// 异步查找流
|
||||||
static void findAsync(const MediaInfo &info, const std::shared_ptr<TcpSession> &session, const function<void(const Ptr &src)> &cb);
|
static void findAsync(const MediaInfo &info, const std::shared_ptr<Session> &session, const function<void(const Ptr &src)> &cb);
|
||||||
// 遍历所有流
|
// 遍历所有流
|
||||||
static void for_each_media(const function<void(const Ptr &src)> &cb,
|
static void for_each_media(const function<void(const Ptr &src)> &cb,
|
||||||
const string &schema = "",
|
const string &schema = "",
|
||||||
|
Loading…
Reference in New Issue
Block a user