Hi3516A音频输出会停止。
2 E币
成为会员,免费下载资料
文件大小:1.29 KB
上传者:飘逸太极
时间:2016-12-27 16:40:36
下载量:5
附件有完整的音频播放的线程代码。主要代码如下。
情况是这样的,如果不接视频(不采集,编码,网络发送),这个音频播放程序可以一直跑下去。
但是如果接入视频,基本上几分钟就在HI_MPI_AO_SendFrame出问题,快的话接入视频就出问题,报错说音频输出缓存为满,然后就卡在这里了。大侠们有没有遇到类似的问题。谢谢。
FILE* pfd = NULL;
pfd = fopen("test.pcm", "rb");
if(NULL == pfd)
{
printf("error open file\n");
}
TRACE_LOG("TEST\n");
int u32ReadLen = 0;
char *pbuff = (char *)calloc(1, 1024);
AUDIO_FRAME_S stAudioStream;
memset(&stAudioStream, 0, sizeof(AUDIO_FRAME_S));
while(1)
{
// TRACE_LOG("TEST\n");
stAudioStream.pVirAddr[0] = pbuff;
u32ReadLen = fread(stAudioStream.pVirAddr[0], 1, 1024, pfd);
if (u32ReadLen <= 0)
{
printf("Readlen:%d\n", u32ReadLen);
printf("Read over\n");
fseek(pfd, 0, SEEK_SET); /*read file again*/
continue;
}
//if (loop++%20==0)
//printf("Readlen:%d\n", u32ReadLen);
stAudioStream.u32Len = u32ReadLen;
s32Ret = HI_MPI_AO_SendFrame(AoDev, AoChn, &stAudioStream, 0);
if (loop++%20==0)
printf("s32Ret:%d\n",s32Ret);
if (HI_SUCCESS != s32Ret)
{
printf("%s: HI_MPI_ADEC_SendStream() failed with %#x!\n", \
__FUNCTION__, s32Ret);
break;
}
}
情况是这样的,如果不接视频(不采集,编码,网络发送),这个音频播放程序可以一直跑下去。
但是如果接入视频,基本上几分钟就在HI_MPI_AO_SendFrame出问题,快的话接入视频就出问题,报错说音频输出缓存为满,然后就卡在这里了。大侠们有没有遇到类似的问题。谢谢。
FILE* pfd = NULL;
pfd = fopen("test.pcm", "rb");
if(NULL == pfd)
{
printf("error open file\n");
}
TRACE_LOG("TEST\n");
int u32ReadLen = 0;
char *pbuff = (char *)calloc(1, 1024);
AUDIO_FRAME_S stAudioStream;
memset(&stAudioStream, 0, sizeof(AUDIO_FRAME_S));
while(1)
{
// TRACE_LOG("TEST\n");
stAudioStream.pVirAddr[0] = pbuff;
u32ReadLen = fread(stAudioStream.pVirAddr[0], 1, 1024, pfd);
if (u32ReadLen <= 0)
{
printf("Readlen:%d\n", u32ReadLen);
printf("Read over\n");
fseek(pfd, 0, SEEK_SET); /*read file again*/
continue;
}
//if (loop++%20==0)
//printf("Readlen:%d\n", u32ReadLen);
stAudioStream.u32Len = u32ReadLen;
s32Ret = HI_MPI_AO_SendFrame(AoDev, AoChn, &stAudioStream, 0);
if (loop++%20==0)
printf("s32Ret:%d\n",s32Ret);
if (HI_SUCCESS != s32Ret)
{
printf("%s: HI_MPI_ADEC_SendStream() failed with %#x!\n", \
__FUNCTION__, s32Ret);
break;
}
}
展开》
折叠》