diff --git a/ext-codec/H264.cpp b/ext-codec/H264.cpp index 953c11fe..7f796ea0 100644 --- a/ext-codec/H264.cpp +++ b/ext-codec/H264.cpp @@ -236,8 +236,8 @@ void H264Track::setExtraData(const uint8_t *data, size_t bytes) { bool H264Track::update() { _config_frames = std::vector{ - createConfigFrame(_sps), - createConfigFrame(_pps) + createConfigFrame(_sps, 0, getIndex()), + createConfigFrame(_pps, 0, getIndex()) }; return getAVCInfo(_sps, _width, _height, _fps); } diff --git a/ext-codec/H264.h b/ext-codec/H264.h index 9940854c..9d662037 100644 --- a/ext-codec/H264.h +++ b/ext-codec/H264.h @@ -134,8 +134,8 @@ private: }; template -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(); frame->_prefix_size = 4; frame->_buffer.assign("\x00\x00\x00\x01", 4); frame->_buffer.append(data); diff --git a/ext-codec/H265.cpp b/ext-codec/H265.cpp index cc0831f6..4bf3e2ff 100644 --- a/ext-codec/H265.cpp +++ b/ext-codec/H265.cpp @@ -183,9 +183,9 @@ void H265Track::setExtraData(const uint8_t *data, size_t bytes) { bool H265Track::update() { _config_frames = std::vector{ - createConfigFrame(_vps), - createConfigFrame(_sps), - createConfigFrame(_pps) + createConfigFrame(_vps, 0, getIndex()), + createConfigFrame(_sps, 0, getIndex()), + createConfigFrame(_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(_vps)); + VideoTrack::inputFrame(createConfigFrame(_vps, frame->dts(), frame->getIndex())); } if (!_sps.empty()) { - VideoTrack::inputFrame(createConfigFrame(_sps)); + VideoTrack::inputFrame(createConfigFrame(_sps, frame->dts(), frame->getIndex())); } if (!_pps.empty()) { - VideoTrack::inputFrame(createConfigFrame(_pps)); + VideoTrack::inputFrame(createConfigFrame(_pps, frame->dts(), frame->getIndex())); } }