avcodec/nvenc: fix hw accelerated transcode with bframes
authorGanapathy Kasi <gkasi@nvidia.com>
Wed, 31 May 2017 02:03:14 +0000 (19:03 -0700)
committerTimo Rothenpieler <timo@rothenpieler.org>
Fri, 2 Jun 2017 19:32:35 +0000 (21:32 +0200)
commit43c417ac1adb89cd2c0fa5e5b6a6d955c792b42d
tree96573a61fbe034a614ea984e71a610de28fc923d
parentb5a0971ff041badbdd1482e4ae2a0a16700a748f
avcodec/nvenc: fix hw accelerated transcode with bframes

hw accelerated transcode (h264_cuvid -> h264_nvenc with -hwaccel cuvid) was
broken after the filtergraph initialization was changed to intialize decoder
first followed by encoder (commit af1761f7b5b1b72197dc40934953b775c2d951cc).
During initialzing encoder with bframes, local buffers are allocated
internally in encoder which fails since no cuda context is available. Now
pushing the correct cuda context before encoder initialization fixes the issue.
Also adding push/pop cuda ctx during create/destroy/map/unmap resources and
destroy encoder session.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
libavcodec/nvenc.c