Clean up something I did for ABI compatability in 1.4

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2008-01-15 23:35:29 +00:00
parent 4fb04cb58a
commit 25e1c74bf1
2 changed files with 4 additions and 10 deletions

View File

@@ -138,13 +138,7 @@ struct ast_trans_pvt {
struct ast_translator *t; struct ast_translator *t;
struct ast_frame f; /*!< used in frameout */ struct ast_frame f; /*!< used in frameout */
int samples; /*!< samples available in outbuf */ int samples; /*!< samples available in outbuf */
/*! /*! \brief actual space used 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.
*/
int datalen; int datalen;
void *pvt; /*!< more private data, if any */ void *pvt; /*!< more private data, if any */
char *outbuf; /*!< the useful portion of the buffer */ 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 ast_trans_pvt *next; /*!< next in translator chain */
struct timeval nextin; struct timeval nextin;
struct timeval nextout; struct timeval nextout;
unsigned int destroy:1;
}; };
/*! \brief generic frameout function */ /*! \brief generic frameout function */

View File

@@ -139,8 +139,7 @@ static void destroy(struct ast_trans_pvt *pvt)
* When ast_frfree() gets called on that frame, this ast_trans_pvt * When ast_frfree() gets called on that frame, this ast_trans_pvt
* will get destroyed, too. */ * will get destroyed, too. */
/* Set the magic hint that this has been requested to be destroyed. */ pvt->destroy = 1;
pvt->datalen = -1;
return; 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)); pvt = (struct ast_trans_pvt *) (((char *) fr) - offsetof(struct ast_trans_pvt, f));
if (pvt->datalen != -1) if (!pvt->destroy)
return; return;
destroy(pvt); destroy(pvt);