diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h index b1f615f7ff11be07fd5b4f0b7fa1eedebe33980f..97f10283f3f7643b4f82ebddad10804c66d35fae 100644 --- a/include/asterisk/translate.h +++ b/include/asterisk/translate.h @@ -138,13 +138,7 @@ struct ast_trans_pvt { struct ast_translator *t; struct ast_frame f; /*!< used in frameout */ int samples; /*!< samples available in outbuf */ - /*! - * \brief actual space used in outbuf - * - * Also, for the sake of ABI compatability, a magic value of -1 in this - * field means that the pvt has been requested to be destroyed, but is - * pending destruction until ast_translate_frame_freed() gets called. - */ + /*! \brief actual space used in outbuf */ int datalen; void *pvt; /*!< more private data, if any */ char *outbuf; /*!< the useful portion of the buffer */ @@ -152,6 +146,7 @@ struct ast_trans_pvt { struct ast_trans_pvt *next; /*!< next in translator chain */ struct timeval nextin; struct timeval nextout; + unsigned int destroy:1; }; /*! \brief generic frameout function */ diff --git a/main/translate.c b/main/translate.c index 8bdaaf082b5dc7a1895606ebfe48d694fabdca4d..1af88ecfb8bfa9ebff413b76939cf3f7c33ccf80 100644 --- a/main/translate.c +++ b/main/translate.c @@ -139,8 +139,7 @@ static void destroy(struct ast_trans_pvt *pvt) * When ast_frfree() gets called on that frame, this ast_trans_pvt * will get destroyed, too. */ - /* Set the magic hint that this has been requested to be destroyed. */ - pvt->datalen = -1; + pvt->destroy = 1; return; } @@ -898,7 +897,7 @@ void ast_translate_frame_freed(struct ast_frame *fr) pvt = (struct ast_trans_pvt *) (((char *) fr) - offsetof(struct ast_trans_pvt, f)); - if (pvt->datalen != -1) + if (!pvt->destroy) return; destroy(pvt);