[FFmpeg-devel] [RFC] Avoid av_read_frame memory copy in implementation

Cyril Russo stage.nexvision
Wed May 26 13:06:49 CEST 2010


Hi all,

   I would like to propose a mechanism to avoid the useless memory copy 
when using av_read_frame in a player environnement.
It's common for multithreaded players to read multiple frames at once 
(to lower I/O bottleneck) and then they buffers theses frames for latter 
decoding.
Currently, one must allocate another buffer to store the returned 
packet's data and copy the data, because initial memory is reused when 
calling av_read_frame again.
It's not a problem when you use the read frame immediately (like in 
transcoding case), but it is when you buffer the frames for later decoding.

To mirror the existing AVCodecContext / get_buffer idea, it would 
probably be a good idea to add a function pointer in AVFormatContext 
called to get a memory buffer to store the read frame into.
What do you think ?

Regards,
Cyril Russo




More information about the ffmpeg-devel mailing list