FFmpegAudioPlayer과 함께 FFMPEG를 사용하여 라이브 스트리밍을 수행하고 있습니다. 내가 가지고있는 문제는 오디오를 디코딩하고 재생할 수 있지만 다른 응용 프로그램에서 동일한 소스를 스트리밍 할 때 오디오에 끊임없는 클릭/소리가 들리는 현상이 있다는 것입니다. 그래서 AudioQueue에 전달하기 전에 문제 때문에 나는 FFMPEG AV_CODEC_ID_PCM_S16BE
오디오 데이터를 처리하는 방법에 발생하는 추측입니다 :AudioQueue에 FFMPEG AV_CODEC_ID_PCM_S16BE 오디오 데이터를 입력하는 방법
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagsCanonical;//kAudioFormatFlagIsBigEndian|kAudioFormatFlagIsAlignedHigh;
audioFormat.mSampleRate = pAudioCodecCtx->sample_rate;
audioFormat.mBitsPerChannel = 8*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
audioFormat.mChannelsPerFrame = pAudioCodecCtx->channels;
audioFormat.mBytesPerFrame = pAudioCodecCtx->channels * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
audioFormat.mBytesPerPacket= pAudioCodecCtx->channels * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
audioFormat.mFramesPerPacket = 1;
audioFormat.mReserved = 0;
pSwrCtx = swr_alloc_set_opts(pSwrCtx,
1,//pAudioCodecCtx->channel_layout,
AV_SAMPLE_FMT_S16,
pAudioCodecCtx->sample_rate,
1,//pAudioCodecCtx->channel_layout,
AV_SAMPLE_FMT_S16,
pAudioCodecCtx->sample_rate,
0,
0);
outCount = swr_convert(pSwrCtx,
(uint8_t **)(&pOut),
in_samples,
(const uint8_t **)pAVFrame1->extended_data,
in_samples);
또한 내가 swr_alloc_set_opts
많은 다른 매개 변수를 시도했습니다 있습니다 만, 중 오디오가 인식 할 수없는되었다하시기 바랍니다 또는 소음이 지속되었습니다.
Here은 클릭 소리가있는 오디오 샘플입니다 (도움이되는 경우).