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.

OMAP5 H.264 encoding freeBufID value problem

Hi,

I'm using the ducati plugin in gstreamer to create an H.264 stream. This basically works, but I see a problem where two consecutive encoder calls occasionally return the same buffer id for freeing.

This causes warnings, which don't stop operation, but the plugin uses the IDs to get the presentation time for the output frame from the input buffer.

It then goes on to 'unref' the buffer, causing more warnings.

I modded the code to assert that the buffer id is valid and print out its address:

  if (!GST_IS_BUFFER(self->outArgs->freeBufID[0]))
    printf("not a buffer: %p\n", (void *)self->outArgs->freeBufID[0]);
  g_assert(GST_IS_BUFFER(self->outArgs->freeBufID[0]));

This causes it to bomb out when the problem occurs. With debug on, this causes the following output:

0:00:03.854569336  3998    0x94380 DEBUG                 ducati gstducatividenc.c:679:gst_ducati_videnc_handle_frame: Calling VIDENC2_process
0:00:03.864315918  3998    0x94380 DEBUG                 ducati gstducatividenc.c:685:gst_ducati_videnc_handle_frame:<ducatih264enc0> VIDENC2_process took    9566569ns (9 ms)
0:00:03.864632975  3998    0x94380 LOG                   ducati gstducatividenc.c:747:gst_ducati_videnc_handle_frame:<ducatih264enc0> free buffer: 0xb5704100
0:00:03.865297852  3998    0x94380 DEBUG                 ducati gstducatividenc.c:679:gst_ducati_videnc_handle_frame: Calling VIDENC2_process
0:00:03.875443522  3998    0x94380 DEBUG                 ducati gstducatividenc.c:685:gst_ducati_videnc_handle_frame:<ducatih264enc0> VIDENC2_process took   10017578ns (10 ms)
0:00:03.875767416  3998    0x94380 LOG                   ducati gstducatividenc.c:747:gst_ducati_videnc_handle_frame:<ducatih264enc0> free buffer: 0xb5704090
0:00:03.876374837  3998    0x94380 DEBUG                 ducati gstducatividenc.c:679:gst_ducati_videnc_handle_frame: Calling VIDENC2_process
0:00:03.886103028  3998    0x94380 DEBUG                 ducati gstducatividenc.c:685:gst_ducati_videnc_handle_frame:<ducatih264enc0> VIDENC2_process took    9562988ns (9 ms)

(gst-launch-0.10:3998): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GstBuffer'
not a buffer: 0xb5704090
**
ERROR:gstducatividenc.c:735:gst_ducati_videnc_handle_frame: assertion failed: (GST_IS_BUFFER(self->outArgs->freeBufID[0]))
Aborted

You can see that the buffer that is not a GST_BUFFER (not a buffer) has the same address as the one free'd in the previous encode cycle.

I changed the plugin code to zero out the ID passed back in each frame after freeing it, so this value does appear to be coming from the encoder process, or maybe copied from unflushed cached memory?

I'm using:

ipc_3_21_00_07, ipumm_3_00_03_04, libdce2-06793e9 and gst-plugin-ducati-6ca21aa3 (last two from git).

Thanks,

Nick.

  • Hi Nick,

    You are using GLSDK, right?

    Can you try with the component sources from latest ti-glsdk_omap5-uevm_6_04_00_02:
     bios_6_37_02_27

    codec_engine_3_24_00_08

    framework_components_3_24_02_15

    ipc_3_21_00_07

    ipumm_3_00_04_02

    xdais_7_24_00_04

    xdctools_3_25_05_94


    Best Regards,

    Yordan

  • Hi Yordon,

    Thanks for your reply.

    Yes I'm using the previous glsdk version, 6_03_00_01.

    Is there some related issue, that you're aware of, that these versions should fix?

    The link to the download for this version of the glsdk has been removed AFAICT. Luckily I downloaded it a while ago, but have not updated to it yet. I'll do that now and check if all the package version numbers you gave above are still accessible from here.

    Is the glsdk 6_10_XX for DRA7 of any use at all on OMAP5?

    Thanks,

    Nick.

  • Hi Yordon,

    I've done an update but still see issues. I'm running this pipeline:

    gst-launch --gst-debug=ducati:9 videotestsrc pattern=smpte100 ! video/x-raw-yuv, framerate=60/1, width=1280, height=720 ! ducatih264enc profile=baseline ! mpegtsmux name=mux ! udpsink host=X.X.X.X port=5000 sync=false

    This issue I see is shown in the debug output from gstreamer:

    0:06:43.438065154  1176    0xab950 DEBUG                 ducati gstducatividenc.c:689:gst_ducati_videnc_handle_frame:<ducatih264enc0> VIDENC2_process took   10270834ns (10 ms)
    0:06:43.438760629  1176    0xab950 LOG                   ducati gstducatividenc.c:747:gst_ducati_videnc_handle_frame:<ducatih264enc0> free buffer
    0:06:43.439156463  1176    0xab950 LOG                   ducati gstducatividenc.c:752:gst_ducati_videnc_handle_frame:<ducatih264enc0> free buffer: 0xb6003410
    0:06:43.451154672  1176    0xab950 ERROR                 ducati gstducatividenc.c:577:gst_ducati_videnc_buffer_lock:<ducatih264enc0> invalid dmabuf for buf = 0xb6001900
    0:06:43.451601449  1176    0xab950 DEBUG                 ducati gstducatividenc.c:636:gst_ducati_videnc_handle_frame:<ducatih264enc0> memcpying input
    0:06:43.454482960  1176    0xab950 DEBUG                 ducati gstducatividenc.c:679:gst_ducati_videnc_handle_frame: fds 0x10 0x12
    0:06:43.454994190  1176    0xab950 DEBUG                 ducati gstducatividenc.c:683:gst_ducati_videnc_handle_frame: Calling VIDENC2_process
    0:06:43.456391977  1176    0xab950 DEBUG                 ducati gstducatividenc.c:689:gst_ducati_videnc_handle_frame:<ducatih264enc0> VIDENC2_process took     805664ns (0 ms)
    0:06:43.456944060  1176    0xab950 WARN                  ducati gstducatividenc.c:693:gst_ducati_videnc_handle_frame:<ducatih264enc0> process failed: err=-1, extendedError=00004400
    0:06:43.457300180  1176    0xab950 ERROR                 ducati gstducati.c:58:gst_ducati_log_extended_error_info: Bit 10 (00000400): insufficient data
    0:06:43.457639861  1176    0xab950 ERROR                 ducati gstducati.c:58:gst_ducati_log_extended_error_info: Bit 14 (00004000): unsupported param
    0:06:43.458658741  1176    0xab950 WARN                  ducati gstducatividenc.c:702:gst_ducati_videnc_handle_frame:<ducatih264enc0> XDM_GETSTATUS: err=0, extendedError=00000000
    ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error.
    Additional debug info:
    gstbasesrc.c(2625): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
    streaming task paused, reason error (-5)
    Execution ended after 403209268604 ns.
    Setting pipeline to PAUSED ...
    0:06:43.460292693  1176    0xab950 DEBUG                 ducati gstducatividenc.c:566:gst_ducati_videnc_finish:<ducatih264enc0> finish
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...
    

    Debugfs trace shows:

    [0][    524.000] loadTask: cpu load = 70%
    [0][    525.000] loadTask: cpu load = 68%
    [0][    538.631] OMAPRPC: received msg type: 4 len: 12 from addr: 1025
    [0][    538.632] OMAPRPC: destroying instance addr: 101
    [0][    538.632] RcmServer_serverThrFxn_P: Exiting thread.
    [1][    538.632] deleteService: removed RcmServer at endpoint: 101
    [1][    538.632] OMAPRPC: Replying with msg type: 7 to addr: 1025  from: 59 len: 16
    [0][    539.000] loadTask: cpu load = 66%
    [0][    540.000] loadTask: cpu load = 32%
    [0][    541.000] loadTask: cpu load = 21%
    

    (how do I change the trace level?)

    This isn't the issue I originally reported but is one of several issues that I see. I sometimes see a similar looking error with only bit 10 set and not bit 16. The subsequent command of XDM_GETSTATUS seems to suggest that there is no error. Is that normal?

    Versions used, with ipumm_3_00_04_02:

    export XDCVERSION=xdctools_3_30_01_25_core
    export BIOSVERSION=bios_6_40_01_15
    export IPCVERSION=ipc_3_21_00_07-m4
    export FCVERSION=framework_components_3_30_00_06
    export CEVERSION=codec_engine_3_24_00_08
    export XDAISVERSION=xdais_7_24_00_04
    
    export TMS470CGTOOLPATH=/opt/ti/TI_CGT_TMS470_5.1.5

    Thanks,

    Nick.

  • Hi Nick,

    "Is there some related issue, that you're aware of, that these versions should fix?"

    GLSDK6_04 has a lot of fixes related to the multimedia. You can see the Release Notes: http://processors.wiki.ti.com/index.php/OMAP5_GLSDK_6.04.00.02_Release_Notes (section Issues closed since GLSDK v6.03:).

    "Is the glsdk 6_10_XX for DRA7 of any use at all on OMAP5?"

     No GLSDK6_10 supports only DRA7xx EVMs.

    As for the errors you see, I think those might be related to the fact that GLSDK6_04 utilizes Wayland instead of X, and in your pipeline you have: video/x-raw-yuv .

    Also, I should double check that, I think there are no applications for h264 or mpeg4 encoding in OMAP5 GLSDKs.

    Best Regards,
    Yordan