修复webrtc播放时生成config rtp线程安全的bug

rtsp直接代理时会从config frame生成rtp,在获取VideoTrack配置帧列表时存在线程安全风险;
同时简化getConfigFrames函数代码,去除缓存逻辑。
This commit is contained in:
xiongziliang
2024-06-21 20:46:17 +08:00
committed by 夏楚
parent 1ef3642ed4
commit 2ead272187
5 changed files with 27 additions and 17 deletions

View File

@@ -182,14 +182,18 @@ void H265Track::setExtraData(const uint8_t *data, size_t bytes) {
}
bool H265Track::update() {
_config_frames = std::vector<Frame::Ptr>{
createConfigFrame<H265Frame>(_vps, 0, getIndex()),
createConfigFrame<H265Frame>(_sps, 0, getIndex()),
createConfigFrame<H265Frame>(_pps, 0, getIndex())
};
return getHEVCInfo(_vps, _sps, _width, _height, _fps);
}
std::vector<Frame::Ptr> H265Track::getConfigFrames() const {
if (!ready()) {
return {};
}
return { createConfigFrame<H265Frame>(_vps, 0, getIndex()),
createConfigFrame<H265Frame>(_sps, 0, getIndex()),
createConfigFrame<H265Frame>(_pps, 0, getIndex()) };
}
Track::Ptr H265Track::clone() const {
return std::make_shared<H265Track>(*this);
}