* Find the flagged lumps and save them in the global lump array * Returns : 0 - codec lumps found * 1 - no lump found * -1 - error */
| 163 | * -1 - error |
| 164 | */ |
| 165 | static int find_codec_lumps(struct sip_msg * msg) |
| 166 | { |
| 167 | struct lump *cur = msg->body_lumps; |
| 168 | int count = 0; |
| 169 | |
| 170 | while( cur) |
| 171 | { |
| 172 | if( cur->flags & LUMPFLAG_CODEC && cur->after && cur->after->after) |
| 173 | count++; |
| 174 | cur = cur->next; |
| 175 | } |
| 176 | |
| 177 | if (count>MAX_STREAMS) { |
| 178 | LM_CRIT("BUG: too many codec lumps found (%d)\n",count); |
| 179 | return -1; |
| 180 | } |
| 181 | |
| 182 | if( count==0 ) { |
| 183 | lumps_len = -1; |
| 184 | return 1; |
| 185 | } |
| 186 | |
| 187 | lumps_len=0; |
| 188 | cur = msg->body_lumps; |
| 189 | while( cur) |
| 190 | { |
| 191 | if( cur->flags & LUMPFLAG_CODEC && cur->after && cur->after->after) |
| 192 | { |
| 193 | lumps[lumps_len] = cur; |
| 194 | lumps_len++; |
| 195 | } |
| 196 | cur = cur->next; |
| 197 | } |
| 198 | LM_DBG("found %d streams\n",lumps_len); |
| 199 | |
| 200 | return 0; |
| 201 | }; |
| 202 | |
| 203 | |
| 204 | static int clone_codec_lumps(void) |