添加addStreamProxy对非法url异常捕获处理 (#2412)

确保抛出异常时,原有代理拉流对象被正常移除,后续可以更新正确url
This commit is contained in:
lijin 2023-04-24 14:32:34 +08:00 committed by GitHub
parent a37b038af6
commit 38e05ab8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,13 @@ void PlayerProxy::play(const string &strUrlTmp) {
strongSelf->_on_close(err); strongSelf->_on_close(err);
} }
}); });
MediaPlayer::play(strUrlTmp); try {
MediaPlayer::play(strUrlTmp);
} catch (std::exception &ex) {
ErrorL << ex.what();
_on_play_result(SockException(Err_other, ex.what()));
return;
}
_pull_url = strUrlTmp; _pull_url = strUrlTmp;
setDirectProxy(); setDirectProxy();
} }