I used DM8168 DVRRDK_03.00.00.00 to implement 2 channel H.264 or MPEG-4 decoding in real time. I have complete MPEG-4 decoding in one channel and H.264 decoding in the other channel.
there is a problem in our solution when I switch MPEG-4 decoding to H.264 decoding in one channel, and the other H.264 decoding maintaining in real time. The code as following:(channel 1, for example)
DecLink_ChannelInfo params_chan;
params_chan.chId = 1;
IpcBitsOutHLOSLink_deleteChBufParams ipcBufDelPrms;
DecLink_addChannelInfo params = {0};
IpcBitsOutHLOSLink_createChBufParams ipcBufCreateParams;
Int32 status = ERROR_NONE;
OSA_mutexLock(&g_apiMutex);
status = System_linkControl(decId, DEC_LINK_CMD_DELETE_CHANNEL,
¶ms_chan, sizeof(params_chan), TRUE);
if (status == 0)
{
memset(&ipcBufDelPrms,0,sizeof(ipcBufDelPrms));
ipcBufDelPrms.chId = 1;
status = System_linkControl(ipcBitsOutHostId,
IPCBITSOUT_LINK_CMD_DELETE_CH_BUFFER,
&ipcBufDelPrms,
sizeof(ipcBufDelPrms), TRUE);
}
OSA_mutexUnlock(&g_apiMutex);
OSA_mutexLock(&g_apiMutex);
params.chId = 1;
params.chInfo.width = 1920;
params.chInfo.height = 1080;
params.chInfo.scanFormat = 1;
params.createPrm.targetMaxWidth = 1920;
params.createPrm.targetMaxHeight = 1080;
params.createPrm.defaultDynamicParams.targetFrameRate = 30;
params.createPrm.defaultDynamicParams.targetBitRate = 4*1000*1000;
params.createPrm.displayDelay = 2;
params.createPrm.numBufPerCh = 6;
params.createPrm.fieldMergeDecodeEnable = FALSE;
params.createPrm.processCallLevel = FALSE;
params.createPrm.dpbBufSizeInFrames = IH264VDEC_DPB_NUMFRAMES_AUTO;
params.createPrm.algCreateStatus = DEC_LINK_ALG_CREATE_STATUS_CREATE;
params.createPrm.format = IVIDEO_H264HP;
params.createPrm.profile = IH264VDEC_PROFILE_ANY;
status = System_linkControl(decId, DEC_LINK_CMD_CREATE_CHANNEL,
¶ms, sizeof(params), TRUE);
if (0 == status)
{
memset (&ipcBufCreateParams,0,sizeof(ipcBufCreateParams));
ipcBufCreateParams.chId = 1;
ipcBufCreateParams.maxWidth = 1920;
ipcBufCreateParams.maxHeight = 1080;
ipcBufCreateParams.numBufs = 2;
status = System_linkControl(ipcBitsOutHostId,
IPCBITSOUT_LINK_CMD_CREATE_CH_BUFFER,
&ipcBufCreateParams,
sizeof(ipcBufCreateParams), TRUE);
}
OSA_mutexUnlock(&g_apiMutex);
The running result :
[host] 3623: IPCBITSOUT:Link[30000018]:
[host] Flush Frame Sent for chId[1]
[host] 3648: IPCBITSOUT:Link[30000018]:
[host] Flush Frame Received for chId[1]
[host] IPC_BITSOUT:BitBuffer Free.PoolID:1,Size:0x3F4800
[host] 3652: IPCBITSOUT:Link[30000018]:
[host] Ch buffer delete completed for chId[1].Total Time[29]
[m3video] DEC : Delete CH1, Dummy Object queued !!!
[m3video] DEC : Delete CH1 Got the Dummy Object queued !!!
[m3video] 16450: DECODE: CH1: Decoder flush needed (0)!!!
[m3video] 16450: DECODE: CH1: Decoder Flushing !!!
[m3video] 16450: DECODE: CH1: Decoder Flushing !!!
[m3video] 16474: IPCBITSIN:Link[1000001a]:
[m3video] Flush Frame received for ch[1]
[m3video] 16474: DECODE: CH1:
[m3video] Queing flush Frame to processQ
[m3video] 16474: DECODE: CH1:
[m3video] Flush Frame Received in ProcessQue
[m3video] 16476: DECODE: CH1:
[m3video] Freeing flush Frame
[m3video] 16476: IPCBITSIN:Link[1000001a]:
[m3video] Flush Frame freed for ch[1]
segement fault.
This problem was caused by creating channel by debugging,or rather to the function DecLinkH264_algCreate( in decLink_h264.c line 794) result in the segement fault.
So what's the bug when I set the parameters or other errors for switching MPEG-4 decoding to H.264 decoding?