mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-15 04:25:58 +08:00
去除rtp_sender_mtx (#1722)
* 去除rtp_sender_mtx * 无人观看定时器指定为MediaSource对象所属poller以确保读取观看数是线程安全的 Co-authored-by: xiongziliang <771730766@qq.com>
This commit is contained in:
@@ -233,10 +233,17 @@ toolkit::EventPoller::Ptr MediaSource::getOwnerPoller() {
|
||||
}
|
||||
|
||||
void MediaSource::onReaderChanged(int size) {
|
||||
auto listener = _listener.lock();
|
||||
if (listener) {
|
||||
listener->onReaderChanged(*this, size);
|
||||
}
|
||||
weak_ptr<MediaSource> weak_self = shared_from_this();
|
||||
getOwnerPoller()->async([weak_self, size]() {
|
||||
auto strong_self = weak_self.lock();
|
||||
if (!strong_self) {
|
||||
return;
|
||||
}
|
||||
auto listener = strong_self->_listener.lock();
|
||||
if (listener) {
|
||||
listener->onReaderChanged(*strong_self, size);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool MediaSource::setupRecord(Recorder::type type, bool start, const string &custom_path, size_t max_second){
|
||||
|
||||
Reference in New Issue
Block a user