mirror of
https://github.com/raspberrypi/userland.git
synced 2025-12-06 04:49:12 +00:00
Fix for missing timestamps when data exceed one buffers worth
The addition of a NAL flag appears to have broken timestamps with large buffers. This simplifies the 'if' around timestamps and takes the NAL change in to account. Also fixed up some bad code formatting after the if statement. Yes, I know.
This commit is contained in:
@@ -1379,22 +1379,19 @@ static void encoder_buffer_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf
|
|||||||
if(pData->flush_buffers) fflush(pData->file_handle);
|
if(pData->flush_buffers) fflush(pData->file_handle);
|
||||||
|
|
||||||
if (pData->pstate->save_pts &&
|
if (pData->pstate->save_pts &&
|
||||||
(buffer->flags & MMAL_BUFFER_HEADER_FLAG_FRAME_END ||
|
!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_CONFIG) &&
|
||||||
buffer->flags == 0 ||
|
buffer->pts != MMAL_TIME_UNKNOWN &&
|
||||||
buffer->flags & MMAL_BUFFER_HEADER_FLAG_KEYFRAME) &&
|
buffer->pts != pData->pstate->lasttime)
|
||||||
!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_CONFIG))
|
|
||||||
{
|
|
||||||
if(buffer->pts != MMAL_TIME_UNKNOWN && buffer->pts != pData->pstate->lasttime)
|
|
||||||
{
|
{
|
||||||
int64_t pts;
|
int64_t pts;
|
||||||
if(pData->pstate->frame==0)pData->pstate->starttime=buffer->pts;
|
if (pData->pstate->frame == 0)
|
||||||
|
pData->pstate->starttime = buffer->pts;
|
||||||
pData->pstate->lasttime = buffer->pts;
|
pData->pstate->lasttime = buffer->pts;
|
||||||
pts = buffer->pts - pData->pstate->starttime;
|
pts = buffer->pts - pData->pstate->starttime;
|
||||||
fprintf(pData->pts_file_handle, "%lld.%03lld\n", pts/1000, pts%1000);
|
fprintf(pData->pts_file_handle, "%lld.%03lld\n", pts/1000, pts%1000);
|
||||||
pData->pstate->frame++;
|
pData->pstate->frame++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mmal_buffer_header_mem_unlock(buffer);
|
mmal_buffer_header_mem_unlock(buffer);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user