It is possible for framein to get called and no channel be available, so do a check...
authorJoshua Colp <jcolp@digium.com>
Fri, 5 Jan 2007 23:51:43 +0000 (23:51 +0000)
committerJoshua Colp <jcolp@digium.com>
Fri, 5 Jan 2007 23:51:43 +0000 (23:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49716 65c4cc65-6c06-0410-ace0-fbb531ad65f3

codecs/codec_zap.c

index b07d3e5..8cd4862 100644 (file)
@@ -142,10 +142,18 @@ static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
        if(!ztp->inuse) {
                ast_mutex_lock(&channelcount);
                if(pvt->t->dstfmt == 8 || pvt->t->dstfmt == 0 ) {
+                       if (complexinuse == totalchannels) {
+                               ast_mutex_unlock(&channelcount);
+                               return -1;
+                       }
                        complexinuse++;
                        if(complexinuse == totalchannels)
                                deactivate_translator(0);
                } else {
+                       if (simpleinuse == totalchannels) {
+                               ast_mutex_unlock(&channelcount);
+                               return -1;
+                       }
                        simpleinuse++;
                        if(simpleinuse == totalchannels)
                                deactivate_translator(1);