Changeset 5000
Only use the frames both parts can provide.
This should avoid ChanSpy getting so easily out of sync.
Committed by:
karvan
Date:
Jun 27 2008 * 14:38 (6 months ago)
Affected files:
callweaver/branches/karvan/apps/app_chanspy.c (unified diff)
| r4997 | r5000 | |
|---|---|---|
| 258 | 258 | { |
| 259 | 259 | |
| 260 | 260 | struct chanspy_translation_helper *csth = data; |
| 261 | struct cw_frame frame, *f0, *f1; | |
| 261 | struct cw_frame frame, *f0, *f1, *f; | |
| 262 | unsigned left, right; | |
| 263 | unsigned same; | |
| 264 | unsigned ii; | |
| 262 | 265 | int len0 = 0; |
| 263 | 266 | int len1 = 0; |
| 264 | 267 | int samp0 = 0; |
| --- | --- | |
| 278 | 281 | |
| 279 | 282 | len = sample * sizeof(int16_t); |
| 280 | 283 | |
| 281 | cw_spy_empty_queues(&csth->spy, &f0, &f1); | |
| 284 | pthread_mutex_lock(&csth->spy.lock); | |
| 285 | left = csth->spy.queue[0].count; | |
| 286 | right = csth->spy.queue[1].count; | |
| 287 | same = left < right ? left : right; | |
| 288 | if (same == 0) { | |
| 289 | pthread_mutex_unlock(&csth->spy.lock); | |
| 290 | return 0; | |
| 291 | } | |
| 292 | ii = 0; | |
| 293 | for (ii = 0, f0 = csth->spy.queue[0].head, f1 = csth->spy.queue[1].head ; ii < same; ++ii) { | |
| 294 | f0 = f0->next; | |
| 295 | f1 = f1->next; | |
| 296 | } | |
| 297 | f = csth->spy.queue[0].head; | |
| 298 | csth->spy.queue[0].head = f0; | |
| 299 | csth->spy.queue[0].count -= same; | |
| 300 | if (!csth->spy.queue[0].count) | |
| 301 | csth->spy.queue[0].tail = NULL; | |
| 302 | f0 = f; | |
| 303 | f = csth->spy.queue[1].head; | |
| 304 | csth->spy.queue[1].head = f1; | |
| 305 | csth->spy.queue[1].count -= same; | |
| 306 | if (!csth->spy.queue[1].count) | |
| 307 | csth->spy.queue[1].tail = NULL; | |
| 308 | f1 = f; | |
| 309 | pthread_mutex_unlock(&csth->spy.lock); | |
| 282 | 310 | while (f0) { |
| 283 | 311 | struct cw_frame *f = f0->next; |
| 284 | 312 | cw_slinfactory_feed(&csth->slinfactory[0], f0); |
![Home changeset 5000 [home]](/images/logo.png?1180520111)
RSS Feeds