ffmpeg解码h264视频流的问题

先上代码:
int VideoDecoder_Decode(X264_H dwHandle, uint8_t *pDataIn, int nInSize, uint8_t *pDataOut, int nOutSize, int *nWidth, int *nHeight)//nOutSize
{
X264_Decoder_Handle *pHandle;
//*i_frame_size = 0;
if (dwHandle == 0)
{
return -1;
}
pHandle = (X264_Decoder_Handle *)dwHandle;

//pHandle->inbuf_ptr = pDataIn;
//pHandle->inSize = nInSize;
pHandle->avpkt.size = nInSize;
pHandle->avpkt.data = pDataIn;
while (pHandle->avpkt.size > 0) {
//LOGI("avcodec_decode_video2\n");
//pHandle->outSize = avcodec_decode_video2(pHandle->c, pHandle->picture, &pHandle->got_picture,
// pHandle->inbuf_ptr, pHandle->inSize);
pHandle->comsumedSize = avcodec_decode_video2(pHandle->c, pHandle->picture, &pHandle->got_picture, &(pHandle->avpkt));
if (pHandle->comsumedSize < 0) {

//LOGE("Error while decoding frame InSize = %d comsumedSize = %d\n", pHandle->avpkt.size,pHandle->comsumedSize);
//exit(1);
printf("222222222222222222222222222222222222222222222222222222222222222");
return -1;
}
if (pHandle->got_picture) {
//printf("saving frame %3d\n", pHandle->frame);
fflush(stdout);

/* the picture is allocated by the decoder. no need to
free it /
*nWidth = pHandle->c->width;
*nHeight = pHandle->c->height;
if(nOutSize >= (pHandle->c->width)
(pHandle->c->height)*3/2)
{
pgm_save2(pHandle->picture->data[0], pHandle->picture->linesize[0],pHandle->c->width, pHandle->c->height,pDataOut);
pgm_save2(pHandle->picture->data[1], pHandle->picture->linesize[1],pHandle->c->width/2, pHandle->c->height/2,pDataOut +pHandle->c->width * pHandle->c->height);
pgm_save2(pHandle->picture->data[2], pHandle->picture->linesize[2],pHandle->c->width/2, pHandle->c->height/2,pDataOut +pHandle->c->width * pHandle->c->height*5/4);
}

pHandle->frame_count++;
}
if (pHandle->avpkt.data) {
pHandle->avpkt.size -= pHandle->comsumedSize;
pHandle->avpkt.data += pHandle->comsumedSize;
}
}
printf("nOutSize: %d (pHandle->c->width)*(pHandle->c->height)*3/2: %d",nOutSize,(pHandle->c->width)*(pHandle->c->height)*3/2);
if(nOutSize < (pHandle->c->width)*(pHandle->c->height)*3/2)
{
printf("33333333333333333333333333333333333333333333333333333333333333");
// printf("nOutSize: %d (pHandle->c->width)*(pHandle->c->height)*3/2: %d",nOutSize,(pHandle->c->width)*(pHandle->c->height)*3/2);
return -1;
}
return 0;
}

用ffmpeg支持64的解码库解码时,这段解码代码在iphone5及以下(32位设备)解码时没问题,但在iphone5以上设备(64位设备)上解码时在以下代码处崩溃了,有人说是地址不匹配:
pHandle->avpkt.size = nInSize;
pHandle->avpkt.data = pDataIn;
崩溃信息如下:
图片说明

到底是什么原因呢,又该怎么解决,哪位大神能够帮忙解答一下,不胜感激....

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问