[FFmpeg-devel] [PATCH 02/13] lavf: update auto-bsf to new BSF API

Jan Sebechlebsky sebechlebskyjan at gmail.com
Wed Jun 29 20:21:07 CEST 2016

Hello Michael,

On 06/29/2016 04:53 AM, Michael Niedermayer wrote:
> On Tue, Jun 28, 2016 at 01:33:13PM +0200, Nicolas George wrote:
>> Le primidi 11 messidor, an CCXXIV, Nicolas George a écrit :
>>> Well, looking at the code, I am thinking that the current design is flawed:
>>> the extra alloc in ff_bsf_get_packet() seems completely useless, and could
>>> be removed as is without any other change in the current code, because all
>>> current filters are 1:1, it would be different for future 1:N filters. Maybe
>>> implementing ff_bsf_peek_packet() and using it to replace
>>> ff_bsf_get_packet() in 1:1 cases would do the trick.
>> I have checked that the following quick-and-dirty changes pass FATE. Making
>> it in shape (testing filters not covered by FATE, making future-proof) would
>> take time that I would like to spend on lavfi right now. But it proves the
>> overhead can be reduced easily.
> applying only the attached patch causes
> ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg  -vbsf noise file.avi
> to
> Segmentation fault
> valgrind is also unhappy
I think Nicolas has not meant the patch to be really used - he suggested 
to create separate ff_bsf_peek_packet function which would just pass 
pointer to packet from internal bsf structure and do not allocate new 
packet structure each time the pointer to existing one is passed. In 
this case caller must not free the packet - just dereference it.
Try attached patch(es) - valgrind seems quite happy.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avcodec-bsf-Add-ff_bsf_peek_packet-function.patch
Type: text/x-patch
Size: 1656 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160629/f20447cd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-avcodec-noise_bsf-Use-ff_bsf_peek_packet-function.patch
Type: text/x-patch
Size: 1073 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160629/f20447cd/attachment-0001.bin>

More information about the ffmpeg-devel mailing list