兼容一些奇怪sdp的rtsp url

This commit is contained in:
xiongziliang
2019-11-21 16:31:50 +08:00
parent e7bd5a4174
commit 54f2c0b53c
5 changed files with 36 additions and 22 deletions

View File

@@ -69,12 +69,18 @@ PlayerBase::PlayerBase() {
///////////////////////////Demuxer//////////////////////////////
bool Demuxer::isInited(int analysisMs) {
if(_ticker.createdTime() < analysisMs){
//analysisMs毫秒内判断条件
//如果音视频都准备好了 说明Track全部就绪
return (_videoTrack && _videoTrack->ready() && _audioTrack && _audioTrack->ready());
if(analysisMs && _ticker.createdTime() > analysisMs){
//analysisMs毫秒后强制初始化完毕
return true;
}
if (_videoTrack && !_videoTrack->ready()) {
//视频未准备好
return false;
}
if (_audioTrack && !_audioTrack->ready()) {
//音频未准备好
return false;
}
//analysisMs毫秒后强制初始化完毕
return true;
}

View File

@@ -236,18 +236,10 @@ protected:
}
void onPlayResult(const SockException &ex) override {
if(!_playResultCB){
return;
}
if(ex){
//播放失败,则立即回调
if(_playResultCB) {
_playResultCB(ex);
_playResultCB = nullptr;
return;
}
//播放成功
_playResultCB(ex);
_playResultCB = nullptr;
}
void onResume() override{