Hi all,

the function:
int avcodec_encode_audio(enc_ctx, buf, buf_size, samples);

returns the number of bytes encoded, so it returns the used size of
buf, which has a maximum dimension of buf_size.

I noticed though that performing a custom encoding with a buf_size
sufficiently scarce (e.g. 10) I usually got an encoder crash (my
workaraound - ugly - is to overdimension the size of the output
buffer, usually many times that of the samples buffer).

So I wonder:

1) is there a reliable method to compute, known the samples size,
(enc_ctx->frame_size) and the encoder, a value for the buffer size
which guarantess that the encoded data will be contained in buf?

2) if the buffer is too small, which should be the correct behaviour
of the various encoders, that is we have to expect them to crash or
they should be fixed (they know buf_size, so they should be able to
say when they're going to write beyond the buffer)?

3) what happens if we just want to encode a part of samples, that is
how can we set the size of the part of frame which we want to encode
(since by default avcodec_encode_audio assumes the size of samples is
enc_ctx->frame_size if I understood it correctly)?

Many thanks in regards for any advice, if you need sample code let me
know.

Regards.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to