修复一个hls相关的一个bug

This commit is contained in:
xiongziliang 2018-11-17 16:34:31 +08:00
parent 4c760d010a
commit 68da7c2fb7
2 changed files with 6 additions and 1 deletions

View File

@ -160,7 +160,9 @@ void HLSMaker::inputH264(void *data, uint32_t length, uint32_t timeStamp) {
} }
case H264Frame::NAL_B_P: //P case H264Frame::NAL_B_P: //P
//insert aud frame before p and SPS frame //insert aud frame before p and SPS frame
_ts.inputH264("\x0\x0\x0\x1\x9\xf0", 6, timeStamp * 90); if(timeStamp != _ui32LastFrameStamp){
_ts.inputH264("\x0\x0\x0\x1\x9\xf0", 6, timeStamp * 90);
}
case H264Frame::NAL_IDR: //IDR case H264Frame::NAL_IDR: //IDR
case H264Frame::NAL_PPS: //PPS case H264Frame::NAL_PPS: //PPS
_ts.inputH264((char *) data, length, timeStamp * 90); _ts.inputH264((char *) data, length, timeStamp * 90);
@ -168,6 +170,8 @@ void HLSMaker::inputH264(void *data, uint32_t length, uint32_t timeStamp) {
default: default:
break; break;
} }
_ui32LastFrameStamp = timeStamp;
} }
void HLSMaker::inputAAC(void *data, uint32_t length, uint32_t timeStamp) { void HLSMaker::inputAAC(void *data, uint32_t length, uint32_t timeStamp) {

View File

@ -80,6 +80,7 @@ private:
uint64_t _ui64TsCnt; uint64_t _ui64TsCnt;
uint32_t _ui32BufSize; uint32_t _ui32BufSize;
uint32_t _ui32LastStamp; uint32_t _ui32LastStamp;
uint32_t _ui32LastFrameStamp = 0;
std::deque<int> _iDurations; std::deque<int> _iDurations;