c - Most efficient file writing method for Linux video recorder -
i'm working on embedded linux video recorder application writes mp4 format video file (on fat format sd card).
some complicating factors video , audio data come hardware codecs have serviced low latency, , must write dma-capable buffers.
at moment output file use open() , write(), find write() can take hundreds of milliseconds return when system under load, writes done in separate thread.
as stands copy data (small, limited number) dma buffers multi-megabyte malloc'd circular buffer, write() in thread. means i'm doing @ least 2 copies, once app buffer, , once system buffer cache.
i considering trying o_direct writes avoid copy, interested in comments. note robert love comments o_direct terrible not why.
on flip side, interested if knows way write() not stall longish periods of time (aio?), use buffer cache linus intended.
this question not unrelated my old question write stalls.
if embedded product in control driver source, i'd looking mmap'ping memory allow user process access same memory device driver , avoid copies.
and here sample implementation of driver memory being shared userspace process using mmap.
Comments
Post a Comment