mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
及时推拉流也能确保第一帧为关键帧
This commit is contained in:
parent
a573d7302b
commit
0a4b59031f
@ -1 +1 @@
|
||||
Subproject commit 72013f5128d8c04bad8b973370da463c311081c0
|
||||
Subproject commit a6b41db987aa2633762fd06e809e0fdb7d60fef0
|
@ -189,9 +189,8 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
//该帧最后一个rtp包 FU-A end
|
||||
_h264frame->_buffer.append((char *)frame + 2, length - 2);
|
||||
_h264frame->_pts = rtppack->timeStamp;
|
||||
auto key = _h264frame->keyFrame();
|
||||
onGetH264(_h264frame);
|
||||
return key;
|
||||
return false;
|
||||
}
|
||||
|
||||
default:{
|
||||
@ -209,8 +208,15 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
}
|
||||
|
||||
void H264RtpDecoder::onGetH264(const H264Frame::Ptr &frame) {
|
||||
//根据pts计算dts
|
||||
auto flag = _dts_generator.getDts(frame->_pts,frame->_dts);
|
||||
if(!flag){
|
||||
if(frame->configFrame() || frame->keyFrame()){
|
||||
flag = true;
|
||||
frame->_dts = frame->_pts;
|
||||
}
|
||||
}
|
||||
|
||||
//根据pts计算dts
|
||||
if(flag){
|
||||
//写入环形缓存
|
||||
RtpCodec::inputFrame(frame);
|
||||
|
@ -127,9 +127,8 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
//该帧最后一个rtp包
|
||||
_h265frame->_buffer.append((char *) frame + 3, length - 3);
|
||||
_h265frame->_pts = rtppack->timeStamp;
|
||||
auto key = _h265frame->keyFrame();
|
||||
onGetH265(_h265frame);
|
||||
return key;
|
||||
return false;
|
||||
}
|
||||
|
||||
default: // 4.4.1. Single NAL Unit Packets (p24)
|
||||
@ -146,6 +145,12 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
void H265RtpDecoder::onGetH265(const H265Frame::Ptr &frame) {
|
||||
//计算dts
|
||||
auto flag = _dts_generator.getDts(frame->_pts,frame->_dts);
|
||||
if(!flag){
|
||||
if(frame->configFrame() || frame->keyFrame()){
|
||||
flag = true;
|
||||
frame->_dts = frame->_pts;
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
//写入环形缓存
|
||||
RtpCodec::inputFrame(frame);
|
||||
|
Loading…
Reference in New Issue
Block a user