mediacodec: fix jni LocalRef leaks

We can only have 512 LocalRefs, so don't leak them.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>