This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMX.TI.DUCATI1.VIDEO.MPEG4E via IOMX under Android 4.0.x

Hello I want to use HW Mp4 encode with Samsung Galaxy Nexus via IOMX, the set parameters are ok,  when I try to allocateBuffer on its input and output port,
since my app is at application layer via NDK, I need use iomx->useBuffer so that I could copy the encoded frame data out,   anyway, the useBuffer always fail
and cause application crash.
Any TI guru could drop some light on me?

Thanks

Steve 

  • Steve;

    Can you provide some more information about your test case?

    1. Are you using a Graphic for decoder output?

    2. Are you modifying the buffer size declared from port definitions value?

    3. You can check how VTC application is handling it, use next patches.

    VTC App:
    http://review.omapzoom.org/#/c/19748/
    location: hardware/ti/omap4xxx/test/VTC
    http://review.omapzoom.org/#/c/19746/
    to apply in mydroid/system/core
    http://review.omapzoom.org/#/c/19749/
    to apply in mydroid/hardware/ti/omap4xxx
    http://review.omapzoom.org/#/c/19745/
    to apply in mydroid/frameworks/base
    http://review.omapzoom.org/#/c/19203/
    to apply in mydroid/hardware/ti/domx

  • Hi Manuel, thanks for response, could you give me the link to
    download VTC application?
    My test case is:
    1. get the iomx for MPEG4 encoder
    2. set input/output ports
    3. put the  OMX state to IDLE
    4. allocateBuffers on input/output port
    5. put the OMX state to Exe

    the steps 1-3 works ok, in the 4th step, I tried iomx->allocateBuffer, iomx->allocateBufferWithBackup
    and iomx->useBuffer, all of them will crash when I step to the function.
    Your questions:
       Are you using a Graphic for decoder output? No, I just want feed frames into MPEG4E and take encoded
     data out for post processing
       Are you modifying the buffer size declared from port definitions value? I get the buffer size via getParam
    on the port, in general, my video is 320X240 and its buffer size is 115200, the buffer count are from
    iomx->getParam. 

     Thanks

    Steve

     

  • Hi Steve,

    VTC code is in previously shared link

    VTC App:
    http://review.omapzoom.org/#/c/19748/

    other patches are needed to get this VTC app running.

    I suggest you to check this VTC code since it is similar to IOMX interface you are using, there are other files in this folder that could help you about encoder configuration.

    Remember to:

    1. check using correct user to access HW or proper permissions/configuration to do so.

    2. if you can do a OMX_GetParameter after OMX_SetParameter for port definitions to read a corrected buffer size value, this value is calculated inside encoder to match used profile and level.

  • Hi Manuel, I tried that link, it opens the Outlook Web App and let me logon, not sure if I have permission to
    access that and seems to be not related(I don't have TI email account, hope I was TI emp :) ) , is it ok that
    you zip it and send to my email tang1013@gmail.com?

    Great appreciated.

    Steve. 

  • My apologies I used incorrect addresses, I just corrected the links in previous post, please try them again.

  • Cool, tried the link again, and it is working now.

    Thanks a lot.

    -Steve

  • Hello Manuel,

         The code is great help, I followed its config, these are the problems I found:
         1. During setParameter on input port, I changed port bufferSize to 115200 (320X240X3/2), although the ret is ok
             when I check the nBufferSize again, its value is 1474560, I also set the SliceHeight to 0, but the value from
             verification is 240.

        OMX_PARAM_PORTDEFINITIONTYPE portDef;
        InitOMXParams(&portDef);
        portDef.nPortIndex = kPortIndexInput;
        err = _iomx->getParameter(_node, OMX_IndexParamPortDefinition, &portDef, sizeof(portDef));
        if (err != OK) {
            LOGE( "get OMX_IndexParamPortDefinition InPort Error:0x%x", err);
            return err;
        }

        portDef.nBufferCountActual = 4;
        portDef.format.video.nFrameWidth = _ecp.frameWidth;
        portDef.format.video.nFrameHeight = _ecp.frameHeight;
        portDef.format.video.nStride = 4096;
        portDef.format.video.nSliceHeight = 0;
        portDef.format.video.nBitrate = _ecp.frameWidth * _ecp.frameHeight * 3 * _ecp.frameRate / 2;
        portDef.format.video.xFramerate = _ecp.frameRate << 16;
        portDef.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
        portDef.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_TI_COLOR_FormatYUV420PackedSemiPlanar;
        portDef.nBufferSize = _ecp.frameWidth * _ecp.frameHeight  * 3 / 2;
        err = _iomx->setParameter(_node, OMX_IndexParamPortDefinition, &portDef, sizeof(portDef));
        if (err != OK) {
            LOGE( "set OMX_IndexParamPortDefinition InPort Error: 0x%x", err);
            return err;
        }

        //verify the port info
        InitOMXParams(&portDef);
        portDef.nPortIndex = kPortIndexInput;
        err = _iomx->getParameter(_node, OMX_IndexParamPortDefinition, &portDef, sizeof(portDef));
        if (err != OK) {
            LOGE( "get OMX_IndexParamPortDefinition InPort Error:0x%x", err);
            return err;
        }

         2. During allocateBuffer on input port, the allocateBufferWithBackup will return 0x80000000 error code.
            err = _iomx->allocateBufferWithBackup(_node, portIndex, mem, (void**)(&info.mBufferHdr));
            if (err != OK) {
                LOGE("allocate_buffer_with_backup failed: code-0x%x", err);
                return err;
            }
            my BufferInfo def is pretty similar to VTC's.
              struct BufferInfo {
                      OMX_BUFFERHEADERTYPE* mBufferHdr;
                      bool mIsCurrentlyInUseByComponent;
                      sp<IMemory> mMem;

                }      

          3. Looks like OMX_VIDEO_PARAM_DATASYNCMODETYPE is not supported, getParam of it will fail

    I'm in non tunnel mode, the component I'm working on is "OMX.TI.DUCATI1.VIDEO.MPEG4E", my
    device is Samsung Galaxy Nexus with Android 4.0.4,  any more hint?

    Thanks

    Steve

  • BTW, I separate the configure to config input port and config output port, I call input config first and then output port,  this is the diff to VTC, will this cause problem?
    I checked TI code, 0x80000000 is OMX_MASK_FATAL, what does this mean? just fatal error?

    Thanks

    Steve

  • After reviewing the possibilities, I can think in one that has most of the percentage, it is that your baseline code in your device is not updated to run actual VTC code changes or to use some variables or changes. There are so many changes in between the 2 versions of code and like you are using IOMX to interact it is not following normal patch for that device.

    One way to discard this if you use your code using latest 4AI1.4P1 in Blaze or Tablet using one of the releases in release notes from omapedia.org.

  • Thanks, do you know how to make existing handset (say Samsung Galaxy Nexus (OMAP4460)) work? I followed Android OMXCore, TI related encoding test code under android source tree and VTC, non of them work, I'm working on commercial software and don't want to ask customer update their handset's system. it will be great to make it work with popular TI OMAP android handsets without any extra work from customer after they installed our application.

    Best Regards

    Steve

  • Steve,

    Support on this forum is limited to the TI reference platforms, such as Blaze and Blaze tablet. The handsets you refer to would be supported by TI customers such as Samsung, directly. TI does not have acces to, so it cannot support customer specific applications and code.

    Regards,

    Magdalena