[vlc-commits] omxil: Update the number of buffers when reconfiguring

Martin Storsjö git at videolan.org
Wed Sep 21 12:36:06 CEST 2011


vlc | branch: master | Martin Storsjö <martin at martin.st> | Wed Sep 21 11:19:05 2011 +0300| [5d0d9decf0320eebcebf171546988671a6cfcfce] | committer: Jean-Baptiste Kempf

omxil: Update the number of buffers when reconfiguring

On OpenMAX devices supported earlier, the number of buffers has
stayed the same after reconfiguring, but on the Nexus One, the
number changes.

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d0d9decf0320eebcebf171546988671a6cfcfce
---

 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..4898ce6 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)



More information about the vlc-commits mailing list