[FFmpeg-devel] FFmpeg MT and HWACCEL mess
michaelni at gmx.at
Sun Mar 27 19:59:35 CEST 2011
On Sun, Mar 27, 2011 at 02:40:58PM +0200, Reimar Döffinger wrote:
> I just had to realize that due all the new thread code in avcodec_open
> making the HWACCEL stuff anything than a messy, broken hack has become
> even harder.
> Since it both initializes the threads and skips calling init, that means
> whether to use threads or not has to be decided during init.
> However we do not have any data available during init, so we have no chance
> of testing whether the hardware supports the given input, nor can we use
> get_format to decide which if any hwaccel to use.
> This also pretty much puts a block on implementing a codec what would
> automatically decide between hwaccel with readback and software decoding.
> Any ideas or should I just finally take the hint and give up on FFmpeg
> supporting hardware decoding in a way that isn't a PITA?
How would you sugest that ffmpeg should handle it?
about having sufficient information early enough, there is extradata
available during init. And our parsers contain code to extract the
global header into extradata.
Also if libavformat is used there is av_find_stream_info() available
that can analyze a stream before the user application opens codecs.
And a decoder that switches between hw and multiframe-threaded software
can be done with a codec that switches between 2 codec instances.
It still has the problem that the 2 variants have different delay
(multiframe software has higher delay) and this should cause problems
with switching independant of implementation
example would be a 1 frame delay hw decoder and at some point it tells
us "oops i dont support this stream" if we now switch to multiframe
sw decoding that maybe uses 16 frames delay to decode 16 frames at
once there will be a delay that has to be buffered by something or
the user will notice a short freeze
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel