[FFmpeg-devel] possible bug in pcm.c

Michael Niedermayer michaelni at gmx.at
Sun Oct 20 19:59:27 CEST 2013


On Sun, Oct 20, 2013 at 05:05:16PM +0200, Lukasz M wrote:
> Hi,
> 
> I work on code that reads stream from input, decodes audio
> with avcodec_decode_audio4 and then encode frame again.
> Output muxer is pulse device. I use AV_CODEC_ID_PCM_S16LE codec (taken from
> device) and AV_SAMPLE_FMT_S16 sample format
> 
> Input has 2 channels. I got a noise on speakers. I was strugging a lot and
> finally debugged it:
> 
> after decoding with avcodec_decode_audio4, frame has sample
> format AV_SAMPLE_FMT_S16P, 2 channels.
> During encoding frame->data[0] is taken as a source for all samples, but it
> has data only for one channel, second one is on frame->data[1]
> 
> static int pcm_encode_frame(...)
> [...]
>     sample_size = av_get_bits_per_sample(avctx->codec->id) / 8;
>     n           = frame->nb_samples * avctx->channels;
>     samples     = (const short *)frame->data[0];
> 
> [...]
> 
> switch (avctx->codec->id) {
> [...]
>     case AV_CODEC_ID_PCM_S16LE:
> #endif /* HAVE_BIGENDIAN */
>     case AV_CODEC_ID_PCM_U8:
>         memcpy(dst, samples, n * sample_size);
>         break;
> 
> It seems pcm_encode_frame doesn't support AV_SAMPLE_FMT_S16P frames
> correctly.

make sure that the sample format you use is in the list of
supported formats of the AVCodec used

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131020/fc46d217/attachment.asc>


More information about the ffmpeg-devel mailing list