mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复播放器线程安全问题:#611
This commit is contained in:
parent
b7d1a5059a
commit
f1c9b7b09c
@ -26,7 +26,14 @@ MediaPlayer::~MediaPlayer() {
|
|||||||
static void setOnCreateSocket_l(const std::shared_ptr<PlayerBase> &delegate, const Socket::onCreateSocket &cb){
|
static void setOnCreateSocket_l(const std::shared_ptr<PlayerBase> &delegate, const Socket::onCreateSocket &cb){
|
||||||
auto helper = dynamic_pointer_cast<SocketHelper>(delegate);
|
auto helper = dynamic_pointer_cast<SocketHelper>(delegate);
|
||||||
if (helper) {
|
if (helper) {
|
||||||
helper->setOnCreateSocket(cb);
|
if (cb) {
|
||||||
|
helper->setOnCreateSocket(cb);
|
||||||
|
} else {
|
||||||
|
//客户端,确保开启互斥锁
|
||||||
|
helper->setOnCreateSocket([](const EventPoller::Ptr &poller) {
|
||||||
|
return Socket::createSocket(poller, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user