[media] coda: allocate bitstream buffer from REQBUFS, size depends on the format
authorPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 24 Mar 2015 17:30:52 +0000 (14:30 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 10 Apr 2015 13:07:58 +0000 (10:07 -0300)
commitad532d37b2958f6c7652429be36ddd46a65ab67a
treea9cf7cc63cd123c88512d4363f6ae9b5b4910d7d
parent73751da61c00db9914ae1c47a25f7462722bc76b
[media] coda: allocate bitstream buffer from REQBUFS, size depends on the format

Allocating the bitstream buffer only when the format is set allows to guarantee
that at least two frames fit into the bitstream buffer. For small frame sizes
a smaller bitstream buffer can be allocated. Since the bitstream buffer size now
depends on the format, replace CODA_MAX_FRAME_SIZE with ctx->bitstream.size
where appropriate and remove the now unused constant.
Since REQBUFS can be called multiple times, but the format can't be changed
unless REQBUFS 0 was called before, we can just keep the allocated context and
bitstream buffers if REQBUFS is called multiple times with a non-zero buffer
count.

[fixed a resource leak preventing repeatedly decoding]

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/coda/coda-bit.c
drivers/media/platform/coda/coda-common.c
drivers/media/platform/coda/coda.h