[FFmpeg-devel] [PATCH] avformat/avio: don't download data twice

Adrian Trzciński atrzcinski at vewd.com
Thu Dec 6 14:28:54 EET 2018


Like I wrote in #7592 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/20181206/7b6e4e91/attachment.bin>


More information about the ffmpeg-devel mailing list