Merge "codec.c: Defensively check the returned samples."

This commit is contained in:
Joshua Colp 2017-10-27 09:19:11 -05:00 committed by Gerrit Code Review
commit 2a898460db
1 changed files with 5 additions and 0 deletions

View File

@ -406,6 +406,11 @@ unsigned int ast_codec_samples_count(struct ast_frame *frame)
if (codec->samples_count) {
samples = codec->samples_count(frame);
if ((int) samples < 0) {
ast_log(LOG_WARNING, "Codec %s returned invalid number of samples.\n",
ast_format_get_name(frame->subclass.format));
samples = 0;
}
} else {
ast_log(LOG_WARNING, "Unable to calculate samples for codec %s\n",
ast_format_get_name(frame->subclass.format));