[vlc-devel] [PATCH 2/5] omxil: Update the number of buffers when reconfiguring
Martin Storsjö
martin at martin.st
Wed Sep 21 10:19:05 CEST 2011
On OpenMAX devices supported earlier, the number of buffers has
stayed the same after reconfiguring, but on the Nexus One, the
number changes.
---
This one was more or less OK'd by courmisch on irc
a few weeks ago.
modules/codec/omxil/omxil.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 0e0b13e..2270022 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -984,6 +984,16 @@ static OMX_ERRORTYPE PortReconfigure(decoder_t *p_dec, OmxPort *p_port)
CHECK_ERROR(omx_error, "OMX_CommandPortEnable on %i failed (%x)",
(int)p_port->i_port_index, omx_error );
+ if (p_port->definition.nBufferCountActual > p_port->i_buffers) {
+ free(p_port->pp_buffers);
+ p_port->pp_buffers = malloc(p_port->definition.nBufferCountActual * sizeof(OMX_BUFFERHEADERTYPE*));
+ if(!p_port->pp_buffers)
+ {
+ omx_error = OMX_ErrorInsufficientResources;
+ CHECK_ERROR(omx_error, "memory allocation failed");
+ }
+ }
+ p_port->i_buffers = p_port->definition.nBufferCountActual;
for(i = 0; i < p_port->i_buffers; i++)
{
if(0 && p_port->b_direct)
--
1.7.2.5
More information about the vlc-devel
mailing list