[Libav-user] Why (c->frame_size = 0) ? -> Could not allocate -22 bytes for samples buffer

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Mar 1 09:54:59 CET 2013


Joe Flowers <joe.flowers at ...> writes:

> The only thing I did was change the line
> codec = avcodec_find_encoder(AV_CODEC_ID_MP2);
> to
> codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE);

> When I run "./decoding_encoding mp2", it ends with: "Could not
> allocate -22 bytes for samples buffer".

For PCM codecs, frame_size is 0 and calling 
av_samples_get_buffer_size() makes no sense.
av_samples_get_buffer_size() returns AVERROR(EINVAL) 
which happens to be "-22".

Carl Eugen



More information about the Libav-user mailing list