mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
修复直接拉流代理失效的bug
This commit is contained in:
parent
a9be01fbec
commit
2dd87c8b59
@ -117,19 +117,22 @@ void PlayerProxy::play(const string &strUrlTmp) {
|
|||||||
});
|
});
|
||||||
MediaPlayer::play(strUrlTmp);
|
MediaPlayer::play(strUrlTmp);
|
||||||
_pull_url = strUrlTmp;
|
_pull_url = strUrlTmp;
|
||||||
|
setDirectProxy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerProxy::setDirectProxy(){
|
||||||
MediaSource::Ptr mediaSource;
|
MediaSource::Ptr mediaSource;
|
||||||
if(dynamic_pointer_cast<RtspPlayer>(_delegate)){
|
if (dynamic_pointer_cast<RtspPlayer>(_delegate)) {
|
||||||
//rtsp拉流
|
//rtsp拉流
|
||||||
GET_CONFIG(bool,directProxy,Rtsp::kDirectProxy);
|
GET_CONFIG(bool, directProxy, Rtsp::kDirectProxy);
|
||||||
if(directProxy){
|
if (directProxy) {
|
||||||
mediaSource = std::make_shared<RtspMediaSource>(_vhost, _app, _stream_id);
|
mediaSource = std::make_shared<RtspMediaSource>(_vhost, _app, _stream_id);
|
||||||
}
|
}
|
||||||
} else if(dynamic_pointer_cast<RtmpPlayer>(_delegate)){
|
} else if (dynamic_pointer_cast<RtmpPlayer>(_delegate)) {
|
||||||
//rtmp拉流,rtmp强制直接代理
|
//rtmp拉流,rtmp强制直接代理
|
||||||
mediaSource = std::make_shared<RtmpMediaSource>(_vhost, _app, _stream_id);
|
mediaSource = std::make_shared<RtmpMediaSource>(_vhost, _app, _stream_id);
|
||||||
}
|
}
|
||||||
if(mediaSource){
|
if (mediaSource) {
|
||||||
setMediaSource(mediaSource);
|
setMediaSource(mediaSource);
|
||||||
mediaSource->setListener(shared_from_this());
|
mediaSource->setListener(shared_from_this());
|
||||||
}
|
}
|
||||||
@ -150,6 +153,7 @@ void PlayerProxy::rePlay(const string &strUrl,int iFailedCnt){
|
|||||||
}
|
}
|
||||||
WarnL << "重试播放[" << iFailedCnt << "]:" << strUrl;
|
WarnL << "重试播放[" << iFailedCnt << "]:" << strUrl;
|
||||||
strongPlayer->MediaPlayer::play(strUrl);
|
strongPlayer->MediaPlayer::play(strUrl);
|
||||||
|
strongPlayer->setDirectProxy();
|
||||||
return false;
|
return false;
|
||||||
}, getPoller());
|
}, getPoller());
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ private:
|
|||||||
|
|
||||||
void rePlay(const string &strUrl,int iFailedCnt);
|
void rePlay(const string &strUrl,int iFailedCnt);
|
||||||
void onPlaySuccess();
|
void onPlaySuccess();
|
||||||
|
void setDirectProxy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enable_hls;
|
bool _enable_hls;
|
||||||
|
Loading…
Reference in New Issue
Block a user