Commit 3651609a by xiongziliang

确保mk_player_release后不再触发回调

parent ff7cf5f4
...@@ -45,6 +45,13 @@ public: ...@@ -45,6 +45,13 @@ public:
}); });
} }
void unset(){
lock_guard<recursive_mutex> lck(_mtx);
_on_play = nullptr;
_on_shutdown = nullptr;
_on_data = nullptr;
}
void onEvent(bool is_shutdown, const SockException &ex){ void onEvent(bool is_shutdown, const SockException &ex){
lock_guard<recursive_mutex> lck(_mtx); lock_guard<recursive_mutex> lck(_mtx);
if(is_shutdown){ if(is_shutdown){
...@@ -125,6 +132,7 @@ API_EXPORT mk_player API_CALL mk_player_create() { ...@@ -125,6 +132,7 @@ API_EXPORT mk_player API_CALL mk_player_create() {
API_EXPORT void API_CALL mk_player_release(mk_player ctx) { API_EXPORT void API_CALL mk_player_release(mk_player ctx) {
assert(ctx); assert(ctx);
MediaPlayerForC::Ptr *obj = (MediaPlayerForC::Ptr *)ctx; MediaPlayerForC::Ptr *obj = (MediaPlayerForC::Ptr *)ctx;
(*obj)->unset();
delete obj; delete obj;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论