lavc/pcm: clarify error message from pcm_decode_frame()

Extend/clarify an error message in case of invalid packet size, and
return a proper error message instead of -1.
Improve debuggability.
This commit is contained in:
Stefano Sabatini 2012-06-22 17:43:40 +02:00
parent 69971410f9
commit 201b409da0

View File

@ -293,8 +293,10 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
if (n && buf_size % n) { if (n && buf_size % n) {
if (buf_size < n) { if (buf_size < n) {
av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n"); av_log(avctx, AV_LOG_ERROR,
return -1; "Invalid PCM packet, data has size %d but at least a size of %d was expected\n",
buf_size, n);
return AVERROR_INVALIDDATA;
} else } else
buf_size -= buf_size % n; buf_size -= buf_size % n;
} }