Hi,
I want to change the resolution setup for encoder dynamically.
So I used ALG_vidEncDelete to close the handle and recreate it by ALG_vidEncCreate.
But I got the EDMA error and can't restart the encoder handle again.What should I make sure to delete the encoder handle?
[output]
Deleting encode algo
EDMA Error: EDMA_IOCRELEASEDMA error
EDMA Error: EDMA_IOCRELEASEDMA error
EDMA Error: EDMA_IOCRELEASEDMA error
...
ENCODE: Creating ALG_vidEnc 0
EDMA Error: EDMA_IOCREQUESTDMA error
ERROR (alg_vidEnc.c|ALG_vidEncCreate|155): Failed to open video encode algorithm: h264enc (0x0)
ERROR (encode_tsk.c|ENCODE_setChResoultion|514): ALG_vidEncCreate(0)
ERROR (encode_tsk.c|ENCODE_tskRun|284): ALG_vidEncRun(0)
[dmesg error]
EDMAK Error: dma_ioctl: RELEASEDMA failed: process c58d6340 not registered for channel 9
EDMAK Error: dma_ioctl: RELEASEDMA failed: process c58d6340 not registered for channel 160
EDMAK Error: dma_ioctl: RELEASEDMA failed: process c58d6340 not registered for channel 10
EDMAK Error: dma_ioctl: RELEASEDMA failed: process c58d6340 not registered for channel 11
EDMAK Error: dma_ioctl: RELEASEDMA failed: process c58d6340 not registered for channel 14
...
[source]
static int ENCODE_tskDeleteAlg(int chId)
{
ENCODE_ChInfo *pChInfo;
pChInfo = &gENCODE_ctrl.chInfo[chId];
if(pChInfo->algVidEncHndl)
{
OSA_printf("Deleting encode algo\n");
ALG_vidEncDelete(pChInfo->algVidEncHndl);
pChInfo->algVidEncHndl = NULL;
}
}
int ENCODE_setChResoultion(int chId, int width, int height)
{
OSA_mutexLock(&gENCODE_ctrl.mutexLock);
if(chId >= 0 && chId < gENCODE_ctrl.createPrm.numCh)
{
ENCODE_ChInfo *pChInfo;
pChInfo->width = OSA_align(width, 32);
pChInfo->height = height;
ENCODE_tskDeleteAlg(chId);
ENCODE_tskCreateAlg(chId, pChInfo->width, pChInfo->height, pChInfo->curBitrate, pChInfo->curKeyFrameInterval);
if(pChInfo->algVidEncHndl == NULL)
{
OSA_ERROR("ALG_vidEncCreate(%d)\n", chId);
}
else
OSA_printf("changed resolution successfuly\n");
}
OSA_mutexUnlock(&gENCODE_ctrl.mutexLock);
return OSA_SOK;
}