[FFmpeg-devel] [PATCH] (for discussion): ffmpeg_filter: initialize cuvid for filter_complex

Miroslav SlugeĊˆ thunder.m at email.cz
Tue Feb 14 10:22:23 EET 2017


Dne 14.2.2017 v 06:51 Hendrik Leppkes napsal(a):
> On Mon, Feb 13, 2017 at 11:00 PM, Timo Rothenpieler
> <timo at rothenpieler.org> wrote:
>>> It is problem in NVENC.
>>>
>>> You create first frame before initialization of NVENC in CUVID, so this
>>> first frame is not accesible to NVENC until
>>> dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context) is called in NVENC.
>>>
>>> This trivial patch should fix your problem.
>>>
>>> M.
>> Very interesting. I don't think this patch is the proper fix though.
>> There never should be an active cuda context when returning from a
>> function, at least that's the premise under which I wrote all cuda
>> related functions so far.
>>
>> This must mean that before, cuvid or something else must somehow have
>> leaked a bound cuda context to nvenc. So that might need fixing as well.
>>
> Indeed having an implicit context active would be rather fragile, so
> best would be to revisit both cuvid and nvenc and make sure contexts
> are explicitly pushed and poped wherever needed - but I assume thats
> what you have planned to do now already. ;)
>
> This reminds me of this patch from Libav which landed a couple weeks ago:
> https://git.libav.org/?p=libav.git;a=commitdiff;h=fb59f87ce72035b940c3f5045884098b9324e1b2
>
> Its hardly complete and only handling it in one place, but its
> probably fixing a similar issue.
>
> - Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Nice catch, this patch in libav should fix it also, i think it should be 
backported as soon as possible.

M.


More information about the ffmpeg-devel mailing list