Xpra: Ticket #398: AVFrameWrapper falling out of scope before being freed by avcodec

As can be seen in ticket:362#comment:6, it seems to be possible for a framewrapper to fall out of scope before it has been freed by avcodec.

This is caused by the buffer management code in #350 (r3976)

Please post log with XPRA_AVCODEC_DEBUG=1 for just 2 or 3 frames as per ticket:350#comment:6.

Do you need to use a specific application to trigger those warnings? Can you reproduce with a simple xterm? Did you apply any patches when you built the installer for win32? What version of ffmpeg did you build against? I've uploaded a new win32 beta - please compare this with your build.



Thu, 01 Aug 2013 16:30:25 GMT - Antoine Martin: description changed


Fri, 02 Aug 2013 08:05:44 GMT - Smo:

Built new x264 and ffmpeg

ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20130801-2245-stable.tar.bz2 http://www.ffmpeg.org/releases/ffmpeg-1.2.2.tar.bz2

No more AVFrameWrapper messages after packaging a new installer with r4041


Fri, 02 Aug 2013 08:07:26 GMT - Antoine Martin: status changed; resolution set

Great - closing as INVALID, must have been an old version of ffmpeg.

(may cause problems for us on some versions of libav/ffmpeg though..)


Wed, 07 Aug 2013 10:00:49 GMT - ahuillet:

I see the problem with latest Archlinux (ffmpeg 2.0).


Wed, 07 Aug 2013 10:01:54 GMT - Antoine Martin: status changed; resolution deleted

Please post some output with XPRA_AVCODEC_DEBUG=1


Wed, 07 Aug 2013 10:02:03 GMT - Antoine Martin: owner, status changed


Wed, 07 Aug 2013 13:29:15 GMT - ahuillet:

Edit by totaam: large comment moved to out-of-scope-debug.log attachment.
Is that enough?


Wed, 07 Aug 2013 14:54:01 GMT - Antoine Martin:

It seems to me like this happens when a window is destroyed, or resized, right? Is this with ffmpeg 2.x? Can I get a bit more context?


What I think is happening is that when we clean the decoder context, we clone the pixel data which calls xpra_free(), then when we call avcodec_close it calls av_free() and all is well. We lose all the references to the wrappers, they get garbage collected and we check that it is safe to free the reference (as the buffer should already have been freed by then). That's on *my* version of ffmpeg... (Linux, OSX and win32)


But here, I am not seeing a single av_free at all. It looks like the avcodec_release_buffer function is never called.


Wed, 07 Aug 2013 15:15:42 GMT - ahuillet:

This is with ffmpeg 2.0. I did not check if it happened when a window was destroyed or resized, but I think it is a reasonable assumption - I remember I got my terminal flooded with those messages when I resized a xterm from very small to very big.


Sat, 10 Aug 2013 05:31:00 GMT - Antoine Martin:

I am closing this ticket after testing on most supported platforms with ffmpeg 1.2.x. If this problem re-occurs with a supported version of ffmpeg, then we can re-open this ticket.

Support for ffmpeg 2.0 is now moved to #415


Note: the buffer support change was messy (esp compat for older versions - patches, etc):


Sat, 10 Aug 2013 05:41:08 GMT - Antoine Martin: status changed; resolution set

(actually closing it)


Tue, 03 Dec 2013 06:22:11 GMT - Antoine Martin: attachment set

log sample for comment:7 (moving large waste of space comment to an attachment)


Sat, 23 Jan 2021 04:54:15 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/398