[vlc-commits] mmal: codec: only get the buffer size when needed
Steve Lhomme
git at videolan.org
Fri Jan 10 16:42:37 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 10 15:53:55 2020 +0100| [f2f024d860820f65087b7896609bbf51bfe4088d] | committer: Steve Lhomme
mmal: codec: only get the buffer size when needed
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f2f024d860820f65087b7896609bbf51bfe4088d
---
modules/hw/mmal/codec.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index 1f2dfe25ad..0d856de2a1 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -392,7 +392,6 @@ static int send_output_buffer(decoder_t *dec)
picture_sys_t *p_sys;
picture_t *picture = NULL;
MMAL_STATUS_T status;
- unsigned buffer_size = 0;
int ret = 0;
if (!sys->output->is_enabled)
@@ -417,12 +416,10 @@ static int send_output_buffer(decoder_t *dec)
}
p_sys = picture->p_sys;
- for (int i = 0; i < picture->i_planes; i++)
- buffer_size += picture->p[i].i_lines * picture->p[i].i_pitch;
-
if (sys->output_pool) {
- mmal_buffer_header_reset(buffer);
- buffer->alloc_size = sys->output->buffer_size;
+ unsigned buffer_size = 0;
+ for (int i = 0; i < picture->i_planes; i++)
+ buffer_size += picture->p[i].i_lines * picture->p[i].i_pitch;
if (buffer_size < sys->output->buffer_size) {
msg_Err(dec, "Retrieved picture with too small data block (%d < %d)",
buffer_size, sys->output->buffer_size);
@@ -430,6 +427,9 @@ static int send_output_buffer(decoder_t *dec)
goto err;
}
+ mmal_buffer_header_reset(buffer);
+ buffer->alloc_size = sys->output->buffer_size;
+
if (!sys->opaque)
buffer->data = picture->p[0].p_pixels;
} else {
More information about the vlc-commits
mailing list