提升单track情况下秒开体验

This commit is contained in:
xia-chu
2021-04-20 17:53:43 +08:00
parent 9b951ab69a
commit 0bb87858a3
7 changed files with 95 additions and 39 deletions

View File

@@ -72,6 +72,11 @@ bool RtmpDemuxer::loadMetaData(const AMFValue &val){
} catch (std::exception &ex) {
WarnL << ex.what();
}
if (ret) {
//metadata中存在track相关的描述那么我们根据metadata判断有多少个track
addTrackCompleted();
}
return ret;
}
@@ -114,7 +119,7 @@ void RtmpDemuxer::makeVideoTrack(const AMFValue &videoCodec, int bit_rate) {
if (_video_rtmp_decoder) {
//设置rtmp解码器代理生成的frame写入该Track
_video_rtmp_decoder->addDelegate(_videoTrack);
onAddTrack(_videoTrack);
addTrack(_videoTrack);
_try_get_video_track = true;
} else {
//找不到相应的rtmp解码器该track无效
@@ -133,7 +138,7 @@ void RtmpDemuxer::makeAudioTrack(const AMFValue &audioCodec,int sample_rate, int
if (_audio_rtmp_decoder) {
//设置rtmp解码器代理生成的frame写入该Track
_audio_rtmp_decoder->addDelegate(_audioTrack);
onAddTrack(_audioTrack);
addTrack(_audioTrack);
_try_get_audio_track = true;
} else {
//找不到相应的rtmp解码器该track无效