mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-03-20 21:10:54 +08:00
完善PlayerProxy关闭机制,重试次数超限后自动关闭
This commit is contained in:
@@ -59,7 +59,7 @@ API_EXPORT void API_CALL mk_proxy_player_play(mk_proxy_player ctx, const char *u
|
||||
* 如果你不调用mk_proxy_player_release函数,那么MediaSource.close()操作将无效
|
||||
* @param user_data 用户数据指针,通过mk_proxy_player_set_on_close函数设置
|
||||
*/
|
||||
typedef void(API_CALL *on_mk_proxy_player_close)(void *user_data);
|
||||
typedef void(API_CALL *on_mk_proxy_player_close)(void *user_data, int err, const char *what, int sys_err);
|
||||
|
||||
/**
|
||||
* 监听MediaSource.close()事件
|
||||
|
||||
@@ -51,9 +51,9 @@ API_EXPORT void API_CALL mk_proxy_player_set_on_close(mk_proxy_player ctx, on_mk
|
||||
PlayerProxy::Ptr &obj = *((PlayerProxy::Ptr *) ctx);
|
||||
obj->getPoller()->async([obj,cb,user_data](){
|
||||
//切换线程再操作
|
||||
obj->setOnClose([cb,user_data](){
|
||||
obj->setOnClose([cb,user_data](const SockException &ex){
|
||||
if(cb){
|
||||
cb(user_data);
|
||||
cb(user_data, ex.getErrCode(), ex.what(), ex.getCustomCode());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user