大家好:
开发环境:基于DM368开发的单板。
使用软件环境:DVSDK4.02
使用的样例程序:dvsdk-demos_4_02_00_01/decode
遇到问题:
(1)在解码视频文件时,当解码的是全部正确的视频文件,能够正常显示。
(2)在解码有误码的视频文件时,decode会报错,并且直接退出。并不是如mplayer那样继续播放出现马赛克。
(3) 视频发生误码的原因是我们的源视频经过传输后接收下来再显示,在传输中不可避免有低概率错误。
(4)发生错误的信息提示及代码位置:
代码位置
Vdec2.c
(f:\forlena\ti-dvsdk\dmai_2_20_00_15\packages\ti\sdo\dmai\ce)
***********************************************
/* Decode video buffer */
status = VIDDEC2_process(hVd->hDecode, &inBufDesc, &outBufDesc, &inArgs,
&outArgs);
Buffer_setNumBytesUsed(hInBuf, outArgs.bytesConsumed);
Dmai_dbg4("VIDDEC2_process() ret %d inId %d inUse %d consumed %d\n",
status, Buffer_getId(hDstBuf), outArgs.outBufsInUseFlag,
outArgs.bytesConsumed);
if (status != VIDDEC2_EOK) {
if (XDM_ISFATALERROR(outArgs.decodedBufs.extendedError)) {
Dmai_err2("VIDDEC2_process() failed with error (%d ext: 0x%x)\n",
(Int)status, (Uns) outArgs.decodedBufs.extendedError);
return Dmai_EFAIL;
}
else {
Dmai_dbg1("VIDDEC2_process() non-fatal error 0x%x\n", (Uns) outArgs.decodedBufs.extendedError); ret = Dmai_EBITERROR;
}
}
1.其中,fatal error错误与non fatal error错误都见过。
2.从ti-dvsdk\codecs-dm365_4_02_00_00\packages\ti\sdo\codecs\h264dec\docs\h264_decoder_dm365_userguide中了解到,当出现fatal error 时,需要XDM_RESET,并且也可以在代码包中找到类似的例子。还没有尝试,是否有效。但我们出现这个错误的情况较少。
3.当出现non fatal error时,我们的错误符合这种描述:
If decoder found serious error in Header, decoder will return from that point with bytesConsumed equal to the stream data consumed till that point. Decoder will also release the output buffer given in that process call (will set freeBufID[0] = inputID ). outputID[0] will be set to 0 (nothing to display
If decoder found frame loss error (one or more complete frame was missing) while parsing the header, decoder will return from that point with bytesConsumed set as 0. Decoder will also release the output buffer given in that process call (will set freeBufID[0] = inputID ). outputID[0] will be set to 0 (nothing to display).
但是没有找到如何能跳过错误的数据,继续解码后续数据的方法。
手册中说,当出现non fatal error时,并没有提到如何处理.
错误时打印的错误提示为:
@192,753,373us: [+0 T:0x41348490 S:0x41347c3c] OM - Memory_getBufferPhysicalAddress> Enter(virtAddr=0x42d7982b, size=4)
@192,753,584us: [+1 T:0x41348490 S:0x41347c3c] OM - Memory__getPhysicalAddress> Enter(virtAddr=0x42d7982b, size=4)
@193,086,195us: [+1 T:0x41348490 S:0x41347c3c] OM - Memory__getPhysicalAddress> found in cb(Sc=0x42c29000, Ec=0x430bb7c0, Ss=0x42d7982b, Es=0x42d7982f, PSc=0x8768b000)
@193,086,460us: [+1 T:0x41348490 S:0x41347c3c] OM - Memory__getPhysicalAddress> returning physAddr=0x877db82b
@193,086,657us: [+0 T:0x41348490 S:0x41347c3c] OM - Memory_getBufferPhysicalAddress> return (0x877db82b)
@193,086,850us: [+2 T:0x41348490 S:0x41347c74] ti.sdo.dmai - [Buffer] Set user pointer 0x42d7982b (physical 0x877db82b)
Loader_getFrame Buffer_setNumBytesUsed = 2097152
@193,087,374us: [+0 T:0x41348490 S:0x41347314] ti.sdo.ce.video2.VIDDEC2 - VIDDEC2_process> Enter (handle=0x22bd20, inBufs=0x41347464, outBufs=0x41347458, inArgs=0x41347cc8, outArgs=0x41347528)
@193,087,652us: [+5 T:0x41348490 S:0x413472f4] CV - VISA_enter(visa=0x22bd20): algHandle = 0x22bd58
@193,087,855us: [+0 T:0x41348490 S:0x413472e4] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Enter(alg=0x22bd58)
@193,088,051us: [+0 T:0x41348490 S:0x413472ac] ti.sdo.ce.osal.SemMP - Entered SemMP_pend> sem[0x22b450] timeout[0xffffffff]
@193,088,281us: [+0 T:0x41348490 S:0x413472ac] ti.sdo.ce.osal.SemMP - Leaving SemMP_pend> sem[0x22b450] status[0]
@193,088,522us: [+0 T:0x41348490 S:0x413472f4] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Exit
ARM Load: 6% Video fps: 4 fps Video bit rate: 416 kbps Sound bit rate: 0 kbps Time: 00:02:44 Resolution: 1920x1080
@193,926,829us: [+5 T:0x41348490 S:0x413472fc] CV - VISA_exit(visa=0x22bd20): algHandle = 0x22bd58
@193,927,185us: [+0 T:0x41348490 S:0x413472ec] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Enter(alg=0x22bd58)
@193,927,444us: [+0 T:0x41348490 S:0x413472cc] ti.sdo.ce.osal.SemMP - Entered SemMP_post> sem[0x22b450]
@193,927,677us: [+0 T:0x41348490 S:0x413472cc] ti.sdo.ce.osal.SemMP - Leaving SemMP_post> sem[0x22b450]
@193,927,879us: [+0 T:0x41348490 S:0x413472fc] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Exit
@193,928,063us: [+0 T:0x41348490 S:0x41347314] ti.sdo.ce.video2.VIDDEC2 - VIDDEC2_process> Exit (handle=0x22bd20, retVal=0xffffffff)
@193,928,269us: [+2 T:0x41348490 S:0x41347364] ti.sdo.dmai - [Vdec2] VIDDEC2_process() ret -1 inId 3 inUse 0 consumed 4178585
@193,928,526us: [+2 T:0x41348490 S:0x41347364] ti.sdo.dmai - [Vdec2] VIDDEC2_process() non-fatal error 0x200
Loader_getFrame
Loader_getFrame Buffer_getNumBytesUsed(hBuf) = 4178585
Loader_getFrame hLoader->async=0
ringBufferEnd = 0X430BB7C0
Loader_readData delta = -2081433
Loader_readData hLoader->w = 0X42F7982B
Loader_readData hLoader->r1 = 0X43175AC4
Loader_readData toRead = 4178585
Loader_readData 4444
Loader_readData 4444 hLoader->r1 =0X43175AC4
Loader_readData 4444 ptr = 0X43175AC4
hLoader->mParams.flags=0
Memory_CACHED 11
Loader_readData 4444 catchUp = 0
Loader_readData numBytes = 2011801
@193,964,888us: [+7 T:0x41348490 S:0x41347c64] ti.sdo.dmai - [Loader] Error reading data from file
numBytes = 2011801 ferror(hLoader->file) = 1
Error: Failed to get frame of encoded data from file system
我理解,这个错误对应的应该就是:
If decoder found serious error in Header, decoder will return from that point with bytesConsumed equal to the stream data consumed till that point. Decoder will also release the output buffer given in that process call (will set freeBufID[0] = inputID ). outputID[0] will be set to 0 (nothing to display
但如果希望decode能够跳过错误数据,继续解码显示后续视频,应该怎么处理呢?
希望能够有人给予指导。:)