diff --git a/src/Codec/H264Encoder.cpp b/src/Codec/H264Encoder.cpp index 92ac2a39..414eb5f1 100644 --- a/src/Codec/H264Encoder.cpp +++ b/src/Codec/H264Encoder.cpp @@ -321,6 +321,8 @@ int H264Encoder::inputData(char *yuv[3], int linesize[3], int64_t cts, H264Frame _aFrames[i].iType = pNal.i_type; _aFrames[i].iLength = pNal.i_payload; _aFrames[i].pucData = pNal.p_payload; + _aFrames[i].dts = _pPicOut->i_dts; + _aFrames[i].pts = _pPicOut->i_pts; } *out_frame = _aFrames; return iNal; diff --git a/src/Codec/H264Encoder.h b/src/Codec/H264Encoder.h index 46c86150..8906c269 100644 --- a/src/Codec/H264Encoder.h +++ b/src/Codec/H264Encoder.h @@ -27,6 +27,9 @@ public: int iType; int iLength; uint8_t *pucData; + + int64_t dts; + int64_t pts; } H264Frame; H264Encoder(); diff --git a/src/Common/Device.cpp b/src/Common/Device.cpp index 9b652911..2d424091 100644 --- a/src/Common/Device.cpp +++ b/src/Common/Device.cpp @@ -39,7 +39,7 @@ bool DevChannel::inputYUV(char *yuv[3], int linesize[3], uint64_t cts) { int frames = _pH264Enc->inputData(yuv, linesize, cts, &out_frames); bool ret = false; for (int i = 0; i < frames; i++) { - ret = inputH264((char *) out_frames[i].pucData, out_frames[i].iLength, cts) ? true : ret; + ret = inputH264((char *) out_frames[i].pucData, out_frames[i].iLength, out_frames[i].dts, out_frames[i].pts) ? true : ret; } return ret; }