mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 04:08:57 +08:00
编码H264时支持时间戳透传,修复时间戳相关问题
This commit is contained in:
parent
189b02e400
commit
4cd735f61d
@ -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].iType = pNal.i_type;
|
||||||
_aFrames[i].iLength = pNal.i_payload;
|
_aFrames[i].iLength = pNal.i_payload;
|
||||||
_aFrames[i].pucData = pNal.p_payload;
|
_aFrames[i].pucData = pNal.p_payload;
|
||||||
|
_aFrames[i].dts = _pPicOut->i_dts;
|
||||||
|
_aFrames[i].pts = _pPicOut->i_pts;
|
||||||
}
|
}
|
||||||
*out_frame = _aFrames;
|
*out_frame = _aFrames;
|
||||||
return iNal;
|
return iNal;
|
||||||
|
@ -27,6 +27,9 @@ public:
|
|||||||
int iType;
|
int iType;
|
||||||
int iLength;
|
int iLength;
|
||||||
uint8_t *pucData;
|
uint8_t *pucData;
|
||||||
|
|
||||||
|
int64_t dts;
|
||||||
|
int64_t pts;
|
||||||
} H264Frame;
|
} H264Frame;
|
||||||
|
|
||||||
H264Encoder();
|
H264Encoder();
|
||||||
|
@ -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);
|
int frames = _pH264Enc->inputData(yuv, linesize, cts, &out_frames);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for (int i = 0; i < frames; i++) {
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user