Freeswitch+Libav with NVENC (TESLA P4) encoder gives Cannot allocate memory

Hello,

I am trying to use Video Conferences (MCU) from Freeswitch with libav (ffmpeg 3.2 from jessie-backports) with NVIDIA Tesla P4 (encoder nvenc).

After 19 video calls (720p), when enter new video call it gives me the next error from libav
avcodec.c:981 Could not open codec (-12)(Cannot allocate memory)

I got the next output from nvidia-smi: nvidia-smi output - FreeSWITCH Pastebin
±----------------------------------------------------------------------------+
| NVIDIA-SMI 375.82 Driver Version: 375.82 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla P4 Off | 0000:03:00.0 Off | 0 |
| N/A 43C P0 24W / 75W | 2432MiB / 7606MiB | 0% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 29328 C /usr/local/freeswitch/bin/freeswitch 2426MiB |
±----------------------------------------------------------------------------+

I am also monitoring the status of NVIDIA Card, with the command nvidia-smi and i check that Freeswitch allocates 2432MB on graphic card and the graphic card have more than 5000MB of memory free. The GPU used is arround 3%, so i think the NVIDIA can support more video calls.

There is any limitation for this card, that doesn’t allow to use the NVENC encoder ?