diff options
author | Joshua Colp <jcolp@digium.com> | 2014-12-12 16:57:26 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2014-12-12 16:57:26 +0000 |
commit | 439e6e1c5d2eaecb4ea132e2c11bb13c42201ab4 (patch) | |
tree | 31f8cf93b326be61f3c165d8ccd4ac7e13dabfe6 /include | |
parent | 01c4e76c4e5ea426f1b16133ae9423e915a72361 (diff) |
media: Fix crash when determining sample count of a frame during shutdown.
When shutting down Asterisk the codecs are cleaned up. As a result anything
attempting to get a codec based on ID or details will find that no codec
exists. This currently occurs when determining the sample count of a frame.
This code did not take this situation into account.
This change fixes this by getting the codec directly from the format and
eliminates the lookup. This is both faster and also provides a guarantee
that the codec will exist and will be valid.
ASTERISK-24604 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4260/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@429497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/format.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asterisk/format.h b/include/asterisk/format.h index 32f9f2b40..3da2d8236 100644 --- a/include/asterisk/format.h +++ b/include/asterisk/format.h @@ -276,6 +276,17 @@ void ast_format_set_attribute_data(struct ast_format *format, void *attribute_da const char *ast_format_get_name(const struct ast_format *format); /*! + * \brief Get the codec associated with a format + * + * \param format The media format + * + * \return The codec + * + * \note The reference count of the returned codec is increased by 1 and must be decremented + */ +struct ast_codec *ast_format_get_codec(const struct ast_format *format); + +/*! * \brief Get the codec identifier associated with a format * * \param format The media format |