mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 12:11:36 +08:00
修复H264/H265创建config帧异常问题(#3643)
https://github.com/ZLMediaKit/ZLMediaKit/pull/3611#issuecomment-2177535917
This commit is contained in:
parent
84dbe4b076
commit
efc683228c
@ -236,8 +236,8 @@ void H264Track::setExtraData(const uint8_t *data, size_t bytes) {
|
||||
|
||||
bool H264Track::update() {
|
||||
_config_frames = std::vector<Frame::Ptr>{
|
||||
createConfigFrame<H264Frame>(_sps),
|
||||
createConfigFrame<H264Frame>(_pps)
|
||||
createConfigFrame<H264Frame>(_sps, 0, getIndex()),
|
||||
createConfigFrame<H264Frame>(_pps, 0, getIndex())
|
||||
};
|
||||
return getAVCInfo(_sps, _width, _height, _fps);
|
||||
}
|
||||
|
@ -134,8 +134,8 @@ private:
|
||||
};
|
||||
|
||||
template <typename FrameType>
|
||||
Frame::Ptr createConfigFrame(const std::string &data, uint64_t dts = 0, int index = 0) {
|
||||
auto frame = FrameType::create();
|
||||
Frame::Ptr createConfigFrame(const std::string &data, uint64_t dts, int index) {
|
||||
auto frame = FrameImp::create<FrameType>();
|
||||
frame->_prefix_size = 4;
|
||||
frame->_buffer.assign("\x00\x00\x00\x01", 4);
|
||||
frame->_buffer.append(data);
|
||||
|
@ -183,9 +183,9 @@ void H265Track::setExtraData(const uint8_t *data, size_t bytes) {
|
||||
|
||||
bool H265Track::update() {
|
||||
_config_frames = std::vector<Frame::Ptr>{
|
||||
createConfigFrame<H265Frame>(_vps),
|
||||
createConfigFrame<H265Frame>(_sps),
|
||||
createConfigFrame<H265Frame>(_pps)
|
||||
createConfigFrame<H265Frame>(_vps, 0, getIndex()),
|
||||
createConfigFrame<H265Frame>(_sps, 0, getIndex()),
|
||||
createConfigFrame<H265Frame>(_pps, 0, getIndex())
|
||||
};
|
||||
return getHEVCInfo(_vps, _sps, _width, _height, _fps);
|
||||
}
|
||||
@ -199,13 +199,13 @@ void H265Track::insertConfigFrame(const Frame::Ptr &frame) {
|
||||
return;
|
||||
}
|
||||
if (!_vps.empty()) {
|
||||
VideoTrack::inputFrame(createConfigFrame<H265Frame>(_vps));
|
||||
VideoTrack::inputFrame(createConfigFrame<H265Frame>(_vps, frame->dts(), frame->getIndex()));
|
||||
}
|
||||
if (!_sps.empty()) {
|
||||
VideoTrack::inputFrame(createConfigFrame<H265Frame>(_sps));
|
||||
VideoTrack::inputFrame(createConfigFrame<H265Frame>(_sps, frame->dts(), frame->getIndex()));
|
||||
}
|
||||
if (!_pps.empty()) {
|
||||
VideoTrack::inputFrame(createConfigFrame<H265Frame>(_pps));
|
||||
VideoTrack::inputFrame(createConfigFrame<H265Frame>(_pps, frame->dts(), frame->getIndex()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user