mirror of
https://github.com/raspberrypi/userland.git
synced 2025-12-06 04:49:12 +00:00
Add media flushing call on when writing bitstream (#554)
Under certain circumstances, the Linux file system write behind caching gets so much data to write in one go that is causes frames to be dropped. The current fflush is not sufficient as that only flushes the C library caches, not the Linux filesystem caches. This fix forces data to be written to media as soon as it arrives, using fdatasync(). Note, currently it's conditional on the --flush command line parameter.
This commit is contained in:
committed by
Phil Elwell
parent
3ddc4e673a
commit
95b29b556a
@@ -1376,7 +1376,11 @@ static void encoder_buffer_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf
|
||||
else
|
||||
{
|
||||
bytes_written = fwrite(buffer->data, 1, buffer->length, pData->file_handle);
|
||||
if(pData->flush_buffers) fflush(pData->file_handle);
|
||||
if(pData->flush_buffers)
|
||||
{
|
||||
fflush(pData->file_handle);
|
||||
fdatasync(fileno(pData->file_handle));
|
||||
}
|
||||
|
||||
if (pData->pstate->save_pts &&
|
||||
!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_CONFIG) &&
|
||||
|
||||
Reference in New Issue
Block a user