[FFmpeg-devel] [FFmpeg-trac] #7592(avformat:new): FFmpeg download data twice

Adrian Trzciński atrzcinski at vewd.com
Tue Dec 4 20:19:24 EET 2018


In case of data muxed in a way, that video and audio packets for the same
ptses are more than 1 sec distant (so when ff_configure_buffers_for_index
changes size of AVIOContext buffers to 2 *
biggest_distance_between_data_for_1_sec_pts) FFmpeg fetches the same data
twice from the server. This is because in fill_buffer in aviobuf.c when we
need data audio from pts x that we don't currently have in buffer, we drop
the whole buffer and download new range. But afterward, we need video from
pts x, which was in buffer already (before seek caused by audio), so we
drop buffer again and seek to this position.

The patch changes the mechanism of data reading in aviobuf.c/fill_buffer.
If data aren't in buffer new mechanism still leaves one time_unit of data
in a buffer for further seeks to the same pts but in a different stream (it
needs to be within one time_unit, it is calculated in
ff_configure_buffers_for_index).

-- 

Pozdrawiam / Regards
Adrian Trzciński
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-avio-fill_buffer-drops-less-data.patch
Type: text/x-patch
Size: 4084 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181204/03f70219/attachment.bin>


More information about the ffmpeg-devel mailing list