mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-07 12:18:12 +08:00
优化获取播放器列表相关功能
This commit is contained in:
@@ -46,7 +46,11 @@ void FlvMuxer::start(const EventPoller::Ptr &poller, const RtmpMediaSource::Ptr
|
||||
std::weak_ptr<FlvMuxer> weak_self = getSharedPtr();
|
||||
media->pause(false);
|
||||
_ring_reader = media->getRing()->attach(poller);
|
||||
_ring_reader->setGetInfoCB([weak_self]() { return dynamic_pointer_cast<HttpSession>(weak_self.lock()); });
|
||||
_ring_reader->setGetInfoCB([weak_self]() {
|
||||
Any ret;
|
||||
ret.set(dynamic_pointer_cast<SockInfo>(weak_self.lock()));
|
||||
return ret;
|
||||
});
|
||||
_ring_reader->setDetachCB([weak_self]() {
|
||||
auto strong_self = weak_self.lock();
|
||||
if (!strong_self) {
|
||||
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
return _ring;
|
||||
}
|
||||
|
||||
void getPlayerList(const std::function<void(const std::list<std::shared_ptr<void>> &info_list)> &cb,
|
||||
const std::function<std::shared_ptr<void>(std::shared_ptr<void> &&info)> &on_change) override {
|
||||
void getPlayerList(const std::function<void(const std::list<toolkit::Any> &info_list)> &cb,
|
||||
const std::function<toolkit::Any(toolkit::Any &&info)> &on_change) override {
|
||||
_ring->getInfoList(cb, on_change);
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,11 @@ void RtmpSession::sendPlayResponse(const string &err, const RtmpMediaSource::Ptr
|
||||
src->pause(false);
|
||||
_ring_reader = src->getRing()->attach(getPoller());
|
||||
weak_ptr<RtmpSession> weak_self = static_pointer_cast<RtmpSession>(shared_from_this());
|
||||
_ring_reader->setGetInfoCB([weak_self]() { return weak_self.lock(); });
|
||||
_ring_reader->setGetInfoCB([weak_self]() {
|
||||
Any ret;
|
||||
ret.set(static_pointer_cast<SockInfo>(weak_self.lock()));
|
||||
return ret;
|
||||
});
|
||||
_ring_reader->setReadCB([weak_self](const RtmpMediaSource::RingDataType &pkt) {
|
||||
auto strong_self = weak_self.lock();
|
||||
if (!strong_self) {
|
||||
|
||||
Reference in New Issue
Block a user