Changeset 1829
- Timestamp:
- Feb 28, 2008 11:39:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/wsola.c
r1827 r1829 590 590 } else { 591 591 unsigned buf_cnt = buf1_cnt + buf2_cnt; 592 unsigned max; 593 594 if (buf_cnt > ERASE_CNT * wsola->samples_per_frame) 592 short *rem; /* remainder */ 593 unsigned rem_cnt; 594 595 if (buf_cnt > ERASE_CNT * wsola->samples_per_frame) { 595 596 buf_cnt = ERASE_CNT * wsola->samples_per_frame; 597 598 rem_cnt = buf1_cnt + buf2_cnt - buf_cnt; 599 rem = buf2 + buf2_cnt - rem_cnt; 600 601 } else { 602 rem = NULL; 603 rem_cnt = 0; 604 } 596 605 597 606 pjmedia_copy_samples(wsola->erasebuf, buf1, buf1_cnt); … … 603 612 buf_cnt -= (*del_cnt); 604 613 605 max = buf_cnt; 606 if (max > buf1_cnt) 607 max = buf1_cnt; 608 pjmedia_copy_samples(buf1, wsola->erasebuf, max); 609 610 if (max < buf_cnt) { 611 pjmedia_copy_samples(buf2, wsola->erasebuf+max, buf_cnt-max); 614 /* Copy back to buffers */ 615 if (buf_cnt == buf1_cnt) { 616 pjmedia_copy_samples(buf1, wsola->erasebuf, buf_cnt); 617 if (rem_cnt) { 618 pjmedia_move_samples(buf2, rem, rem_cnt); 619 } 620 } else if (buf_cnt < buf1_cnt) { 621 pjmedia_copy_samples(buf1, wsola->erasebuf, buf_cnt); 622 if (rem_cnt) { 623 unsigned c = rem_cnt; 624 if (c > buf1_cnt-buf_cnt) { 625 c = buf1_cnt-buf_cnt; 626 } 627 pjmedia_copy_samples(buf1+buf_cnt, rem, c); 628 rem += c; 629 rem_cnt -= c; 630 if (rem_cnt) 631 pjmedia_move_samples(buf2, rem, rem_cnt); 632 } 633 } else { 634 pjmedia_copy_samples(buf1, wsola->erasebuf, buf1_cnt); 635 pjmedia_copy_samples(buf2, wsola->erasebuf+buf1_cnt, 636 buf_cnt-buf1_cnt); 637 if (rem_cnt) { 638 pjmedia_move_samples(buf2+buf_cnt-buf1_cnt, rem, 639 rem_cnt); 640 } 612 641 } 642 613 643 } 614 644 }
Note: See TracChangeset
for help on using the changeset viewer.