mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-31 00:37:39 +08:00
完善gop缓存机制,提高秒开率
This commit is contained in:
parent
2a60fc2610
commit
ce5c71c994
@ -100,9 +100,10 @@ public:
|
||||
MediaSource::regist();
|
||||
_bRegisted = true;
|
||||
}
|
||||
} else{
|
||||
_mapStamp[pkt->typeId] = pkt->timeStamp;
|
||||
_pRing->write(pkt,pkt->isVideoKeyFrame());
|
||||
}
|
||||
_mapStamp[pkt->typeId] = pkt->timeStamp;
|
||||
_pRing->write(pkt,pkt->isVideoKeyFrame());
|
||||
}
|
||||
|
||||
uint32_t getTimeStamp(TrackType trackType) override {
|
||||
|
@ -153,10 +153,6 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
|
||||
|
||||
switch (type){
|
||||
case 5:
|
||||
//在IDR帧之前插入config包
|
||||
if(_gotSpsPps){
|
||||
makeVideoConfigPkt();
|
||||
}
|
||||
case 1:{
|
||||
//I or P or B frame
|
||||
int8_t flags = 7; //h.264
|
||||
@ -230,7 +226,7 @@ void H264RtmpEncoder::makeVideoConfigPkt() {
|
||||
rtmpPkt->streamId = STREAM_MEDIA;
|
||||
rtmpPkt->timeStamp = 0;
|
||||
rtmpPkt->typeId = MSG_VIDEO;
|
||||
RtmpCodec::inputRtmp(rtmpPkt, true);
|
||||
RtmpCodec::inputRtmp(rtmpPkt, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,7 +257,7 @@ void H264RtpEncoder::makeH264Rtp(const void* data, unsigned int len, bool mark,
|
||||
rtppkt->offset = 16;
|
||||
|
||||
uint8_t type = ((uint8_t *) (data))[0] & 0x1F;
|
||||
RtpCodec::inputRtp(rtppkt,type == 5);
|
||||
RtpCodec::inputRtp(rtppkt,type == 7);
|
||||
_ui16Sequence++;
|
||||
_ui32TimeStamp = uiStamp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user