mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
直接打印SockException类
This commit is contained in:
parent
de8249592e
commit
c8a20f85f6
@ -1 +1 @@
|
|||||||
Subproject commit 1337142746b84ef157a455aefcae5523baa22404
|
Subproject commit a73cda127c221b788cc02db5ad98e49b0da56d52
|
@ -966,7 +966,7 @@ void installWebApi() {
|
|||||||
//开始推流,如果推流失败或者推流中止,将会自动重试若干次,默认一直重试
|
//开始推流,如果推流失败或者推流中止,将会自动重试若干次,默认一直重试
|
||||||
pusher->setPushCallbackOnce([cb, key, url](const SockException &ex) {
|
pusher->setPushCallbackOnce([cb, key, url](const SockException &ex) {
|
||||||
if (ex) {
|
if (ex) {
|
||||||
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex.what();
|
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex;
|
||||||
lock_guard<recursive_mutex> lck(s_proxyPusherMapMtx);
|
lock_guard<recursive_mutex> lck(s_proxyPusherMapMtx);
|
||||||
s_proxyPusherMap.erase(key);
|
s_proxyPusherMap.erase(key);
|
||||||
}
|
}
|
||||||
@ -975,7 +975,7 @@ void installWebApi() {
|
|||||||
|
|
||||||
//被主动关闭推流
|
//被主动关闭推流
|
||||||
pusher->setOnClose([key, url](const SockException &ex) {
|
pusher->setOnClose([key, url](const SockException &ex) {
|
||||||
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex.what();
|
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex;
|
||||||
lock_guard<recursive_mutex> lck(s_proxyPusherMapMtx);
|
lock_guard<recursive_mutex> lck(s_proxyPusherMapMtx);
|
||||||
s_proxyPusherMap.erase(key);
|
s_proxyPusherMap.erase(key);
|
||||||
});
|
});
|
||||||
|
@ -96,7 +96,7 @@ static onceToken token([]() {
|
|||||||
static void parse_http_response(const SockException &ex, const Parser &res, const function<void(const Value &, const string &, bool)> &fun) {
|
static void parse_http_response(const SockException &ex, const Parser &res, const function<void(const Value &, const string &, bool)> &fun) {
|
||||||
bool should_retry = true;
|
bool should_retry = true;
|
||||||
if (ex) {
|
if (ex) {
|
||||||
auto errStr = StrPrinter << "[network err]:" << ex.what() << endl;
|
auto errStr = StrPrinter << "[network err]:" << ex << endl;
|
||||||
fun(Json::nullValue, errStr, should_retry);
|
fun(Json::nullValue, errStr, should_retry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &sender, const MediaSourceE
|
|||||||
if (auto strong_self = weak_self.lock()) {
|
if (auto strong_self = weak_self.lock()) {
|
||||||
// 可能归属线程发生变更
|
// 可能归属线程发生变更
|
||||||
strong_self->getOwnerPoller(MediaSource::NullMediaSource())->async([=]() {
|
strong_self->getOwnerPoller(MediaSource::NullMediaSource())->async([=]() {
|
||||||
WarnL << "stream:" << strong_self->shortUrl() << " stop send rtp:" << ssrc << ", reason:" << ex.what();
|
WarnL << "stream:" << strong_self->shortUrl() << " stop send rtp:" << ssrc << ", reason:" << ex;
|
||||||
strong_self->_rtp_sender.erase(ssrc);
|
strong_self->_rtp_sender.erase(ssrc);
|
||||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastSendRtpStopped, *strong_self, ssrc, ex);
|
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastSendRtpStopped, *strong_self, ssrc, ex);
|
||||||
});
|
});
|
||||||
|
@ -118,7 +118,7 @@ void HlsPlayer::fetchSegment() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
WarnL << "Download ts segment " << url << " failed:" << err.what();
|
WarnL << "Download ts segment " << url << " failed:" << err;
|
||||||
if (err.getErrCode() == Err_timeout) {
|
if (err.getErrCode() == Err_timeout) {
|
||||||
strong_self->_timeout_multiple = MAX(strong_self->_timeout_multiple + 1, MAX_TIMEOUT_MULTIPLE);
|
strong_self->_timeout_multiple = MAX(strong_self->_timeout_multiple + 1, MAX_TIMEOUT_MULTIPLE);
|
||||||
}else{
|
}else{
|
||||||
|
@ -101,7 +101,7 @@ void HttpSession::onError(const SockException& err) {
|
|||||||
uint64_t duration = _ticker.createdTime() / 1000;
|
uint64_t duration = _ticker.createdTime() / 1000;
|
||||||
WarnP(this) << "FLV/TS/FMP4播放器("
|
WarnP(this) << "FLV/TS/FMP4播放器("
|
||||||
<< _mediaInfo.shortUrl()
|
<< _mediaInfo.shortUrl()
|
||||||
<< ")断开:" << err.what()
|
<< ")断开:" << err
|
||||||
<< ",耗时(s):" << duration;
|
<< ",耗时(s):" << duration;
|
||||||
|
|
||||||
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
|
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
|
||||||
@ -111,9 +111,6 @@ void HttpSession::onError(const SockException& err) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//http客户端
|
|
||||||
TraceP(this) << err.what();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSession::onManager() {
|
void HttpSession::onManager() {
|
||||||
|
@ -101,7 +101,7 @@ void RtmpPlayer::onPlayResult_l(const SockException &ex, bool handshake_done) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WarnL << ex.getErrCode() << " " << ex.what();
|
WarnL << ex.getErrCode() << " " << ex;
|
||||||
if (!handshake_done) {
|
if (!handshake_done) {
|
||||||
//开始播放阶段
|
//开始播放阶段
|
||||||
_play_timer.reset();
|
_play_timer.reset();
|
||||||
|
@ -336,7 +336,7 @@ void RtpSender::onFlushRtpList(shared_ptr<List<Buffer::Ptr> > rtp_list) {
|
|||||||
|
|
||||||
void RtpSender::onErr(const SockException &ex) {
|
void RtpSender::onErr(const SockException &ex) {
|
||||||
_is_connect = false;
|
_is_connect = false;
|
||||||
WarnL << "send rtp connection lost: " << ex.what();
|
WarnL << "send rtp connection lost: " << ex;
|
||||||
onClose(ex);
|
onClose(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void RtpServer::connectToServer(const std::string &url, uint16_t port, const fun
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
WarnL << "连接到服务器 " << url << ":" << port << " 失败 " << err.what();
|
WarnL << "连接到服务器 " << url << ":" << port << " 失败 " << err;
|
||||||
} else {
|
} else {
|
||||||
InfoL << "连接到服务器 " << url << ":" << port << " 成功";
|
InfoL << "连接到服务器 " << url << ":" << port << " 成功";
|
||||||
strong_self->onConnect();
|
strong_self->onConnect();
|
||||||
|
@ -60,7 +60,7 @@ void RtpSession::onRecv(const Buffer::Ptr &data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RtpSession::onError(const SockException &err) {
|
void RtpSession::onError(const SockException &err) {
|
||||||
WarnP(this) << _stream_id << " " << err.what();
|
WarnP(this) << _stream_id << " " << err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtpSession::onManager() {
|
void RtpSession::onManager() {
|
||||||
|
@ -57,7 +57,7 @@ void ShellSession::onRecv(const Buffer::Ptr&buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShellSession::onError(const SockException &err){
|
void ShellSession::onError(const SockException &err){
|
||||||
WarnP(this) << err.what();
|
WarnP(this) << err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellSession::onManager() {
|
void ShellSession::onManager() {
|
||||||
|
@ -117,7 +117,7 @@ void SrtSession::onError(const SockException &err) {
|
|||||||
// udp链接超时,但是srt链接不一定超时,因为可能存在udp链接迁移的情况
|
// udp链接超时,但是srt链接不一定超时,因为可能存在udp链接迁移的情况
|
||||||
//在udp链接迁移时,新的SrtSession对象将接管SrtSession对象的生命周期
|
//在udp链接迁移时,新的SrtSession对象将接管SrtSession对象的生命周期
|
||||||
//本SrtSession对象将在超时后自动销毁
|
//本SrtSession对象将在超时后自动销毁
|
||||||
WarnP(this) << err.what();
|
WarnP(this) << err;
|
||||||
|
|
||||||
if (!_transport) {
|
if (!_transport) {
|
||||||
return;
|
return;
|
||||||
|
@ -33,7 +33,7 @@ protected:
|
|||||||
}
|
}
|
||||||
//被动断开连接回调
|
//被动断开连接回调
|
||||||
void onErr(const SockException &ex) override {
|
void onErr(const SockException &ex) override {
|
||||||
WarnL << ex.what();
|
WarnL << ex;
|
||||||
}
|
}
|
||||||
//tcp连接成功后每2秒触发一次该事件
|
//tcp连接成功后每2秒触发一次该事件
|
||||||
void onManager() override {
|
void onManager() override {
|
||||||
@ -42,7 +42,7 @@ protected:
|
|||||||
}
|
}
|
||||||
//连接服务器结果回调
|
//连接服务器结果回调
|
||||||
void onConnect(const SockException &ex) override{
|
void onConnect(const SockException &ex) override{
|
||||||
DebugL << ex.what();
|
DebugL << ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
//数据全部发送完毕后回调
|
//数据全部发送完毕后回调
|
||||||
|
@ -103,7 +103,7 @@ void WebRtcSession::onError(const SockException &err) {
|
|||||||
//udp链接超时,但是rtc链接不一定超时,因为可能存在链接迁移的情况
|
//udp链接超时,但是rtc链接不一定超时,因为可能存在链接迁移的情况
|
||||||
//在udp链接迁移时,新的WebRtcSession对象将接管WebRtcTransport对象的生命周期
|
//在udp链接迁移时,新的WebRtcSession对象将接管WebRtcTransport对象的生命周期
|
||||||
//本WebRtcSession对象将在超时后自动销毁
|
//本WebRtcSession对象将在超时后自动销毁
|
||||||
WarnP(this) << err.what();
|
WarnP(this) << err;
|
||||||
|
|
||||||
if (!_transport) {
|
if (!_transport) {
|
||||||
return;
|
return;
|
||||||
|
@ -1054,7 +1054,7 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, int &len, void *ctx
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcTransportImp::onShutdown(const SockException &ex) {
|
void WebRtcTransportImp::onShutdown(const SockException &ex) {
|
||||||
WarnL << ex.what();
|
WarnL << ex;
|
||||||
unrefSelf();
|
unrefSelf();
|
||||||
for (auto &tuple : _ice_server->GetTuples()) {
|
for (auto &tuple : _ice_server->GetTuples()) {
|
||||||
tuple->shutdown(ex);
|
tuple->shutdown(ex);
|
||||||
|
Loading…
Reference in New Issue
Block a user