完善gop缓存机制,提高秒开率

This commit is contained in:
xiongziliang 2018-10-26 22:58:32 +08:00
parent 2a60fc2610
commit ce5c71c994
3 changed files with 5 additions and 8 deletions

View File

@ -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 {

View File

@ -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);
}

View File

@ -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;
}