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.

DM365 H.264 encoder hang up in multiple instances.



Hi,

  The version of DVSDK is 4.0 and the H.264 encoder is 02_10_00_06.

  I created two instances of H.264 encoder. One is for CIF input and another is for D1 input.

At about 50% channce the encoder will hangup in VIDENC1_process. During hang up, with the ps command:

ps  H -eo user,pid,ppid,tid,time,%cpu,cmd,wchan

 I got:

root      1478  1447  1481 00:00:01  7.8 ./elss                      down_interruptible

The 1481 is the thread no. of the CIF encoder. So it seems the encoder is waiting for an interrupt?

I can't reproduce this problem when only one encoder instance is used.

Edit: attached the log file with CE_DEBUG=3

Regards,

lcj

CE_Debug.zip
  • Hi,

    Can you please provide create and dynamic parameters?

    what value you are setting for 'resetHDVICPeveryFrame' flag? if it zero, please make it 1 .

    And for codec related question please ask in 'Multimedia Software Codecs forum' .

  • The settings of CIF encoder:

    IVIDENC1_Params->

    encodingPreset:1
    rateControlPreset:2
    maxHeight:288
    maxWidth:352
    maxFrameRate:30000
    maxBitRate:10000000
    dataEndianness:1
    maxInterFrameInterval:1
    inputChromaFormat:9
    inputContentType:0

    IVIDENC1_DynamicParams->

    (The ratecontrol of CIF encoder is set to VBR, so the dynamic params is set to use the common dynamic params of venc1)

    inputHeight:288
    inputWidth:352
    refFrameRate:25000
    targetFrameRate:25000
    targetBitRate:200000
    intraFrameInterval:125
    generateHeader:0
    captureWidth:384

    The setting of the D1 encoder:

    IVIDENC1_Params->

    encodingPreset:1
    rateControlPreset:5
    maxHeight:576
    maxWidth:704
    maxFrameRate:30000
    maxBitRate:10000000
    dataEndianness:1
    maxInterFrameInterval:1
    inputChromaFormat:9
    inputContentType:0

    IH264VENC_DynamicParams

    (The ratecontrol of D1 encoder is set to CVBR, so the dynamic params is set to use the H264 dynamic params)

    inputHeight:576
    inputWidth:704
    refFrameRate:25000
    targetFrameRate:25000
    targetBitRate:600000
    intraFrameInterval:125
    generateHeader:0
    captureWidth:704
    sliceSize:0
    airRate:0
    intraFrameQP:28
    interPFrameQP:28
    initQ:28
    rcQMax:40
    rcQMin:0
    rcQMaxI:38
    rcQMinI:0
    rcAlgo:3
    maxDelay:500
    aspectRatioX:1
    aspectRatioY:1
    lfDisableIdc:0
    enableBufSEI:0
    enablePicTimSEI:0
    perceptualRC:1
    idrFrameInterval:0
    mvSADoutFlag:0
    resetHDVICPeveryFrame:1
    enableROI:0
    metaDataGenerateConsume:0
    maxBitrateCVBR:6000000
    interlaceRefMode:0
    enableGDR:0
    GDRduration:0
    LongTermRefreshInterval:0
    UseLongTermFrame:0
    SetLongTermFrame:0
    VUI_Buffer:0
    CustomScaleMatrix_Buffer:0
    putDataGetSpaceFxn:0
    dataSyncHandle:0

    Sorry I don't know how to move this topic to Multimedia codec forum.

    Should I delete it in this forum  and post it on another ?

    Regards,

    lcj

  • Its ok from next question you can ask in multimedia codec forum.

    Can you please provide you create and dynamic parameters?

     

  • I forgot to post the params in my first reply. So I edited it and the params are posted in the edited reply. Is that you required?

    thanks.

     

  • Hi,

    Can you please try following things,

    1: Please use extended params for both instances. I think your streaming also running please turn it off.

    2: if above steps doesn't work, please use codec debug libary and send us log.

    To check multiinstances we have readymade setup for 1080p(1920x1080p)+D1(720x480), here it is working fine. We used extended params.

  • 1: Please use extended params for both instances. I think your streaming also running please turn it off.

    I tried extended dynamic params for both instances and got the same error. I'm not clear  what is "streaming" .

    BTW: sometime the encoder will not hang up but give error code 0x8010

    2: if above steps doesn't work, please use codec debug libary and send us log.

    I don't know how to use debug codec library. Could you give me some advice?

  • Hi

    Can you use "h264venc_ti_arm926_debug.a" (which is debug library and dumps more information)) instead of "h264venc_ti_arm926.a" and share the logs. Streaming means I think you are sending output bitstream to display( may be using rtsp) please turn off this thread.

    errorcode 0x8010 means process call returning error (please see ih264enc.h file for more info about error code).

    One more thing can you try some other resolution? like D1+D1.

  • Hi

     I did more tests. The streaming is turned off and the h264venc_ti_arm926_debug.a is used. The log file is in the attachment.

    Two D1 instances is tried and got the same error.

    FYI, The steps to reproduce the error:

    1. Engine_open/Venc1_create to create  encoder instance A.

    2.  step a) Encoder A encodes only one frame . step b) Engine_open/Venc1_create to create encoder instance B .(step a & step b may be run at the "same" time since they are in different threads)

    3 . Encoder B encodes only one frame.

    4. Destroy Encoder A/B by Venc1_delete/Engine_close

    Then repeat the 4 steps.

    In step 1/2, if Encoder B is created after Encoder A created immediately, the error will appear almost every time. But if  Encoder B is created after Encoder A by one second, the error will seldom appear.

    Regards,

    lcj

    CE_debug.zip
  • Hi,

    In our demo setup for mult-instance, process calls are in single thread. Can you try once to have process calls in same thread?

    One more thing i observed in logs, process call is getting pre-empted by other thread, that time process call returning FATAL_ERROR. But in starting 2-3 process calls are not pre-empted, they are returning successfully. Can you try avoid these pre-emption?

  • It's not an easy work to have all process calls in same thread, but I tried to use a global mutex to serialize every process call in all threads.

    The results is exciting. The problem disappeared!

    Many thanks.

    BTW: Isn't the thread-safe process call should be guaranteed by codec engine or codec?

    The same code (no serialized mutex) was used before in DM6446 and no such problem.

    Regards,

    lcj

  • What is the version of linuxutils and framework components that you use?

    Regards,

    Anshuman

  • The version is: linuxutils_2_25_05_11 / framework-components_2_25_03_07.

    Regards,

     lcj

  • Thanks Veeranna,

    I appreciate for your input on the Pre-emption issue by other thread for Process() call.

    I had similar problem while implementing MD. 

    It really helped me and saved a lot time. Earlier i was unaware of this kind of issue.