codec.c: Defensively check the returned samples.
authorRichard Mudgett <rmudgett@digium.com>
Wed, 25 Oct 2017 19:38:19 +0000 (14:38 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 26 Oct 2017 16:48:20 +0000 (11:48 -0500)
commit2ca3dbb197078e4381b932cc7d83ca8b6c088fd1
tree624dd8b7cc04b548de55d0a7477d863068dc06de
parent4f2717bab0a6aecc38083b22eb96e3c847fa32fc
codec.c: Defensively check the returned samples.

Earlier versions of the codec_opus samples_count callback can return
negative error values on undecodable frames.  This resulted in a divide by
zero exception.

* Added a defensive check in ast_codec_samples_count() for a "negative"
samples count return value.  Log the event and set the count to zero.

ASTERISK-27194

Change-Id: Icf69350307ecbbc80a3d74de46af9bd80ea17819
main/codec.c