Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -94,7 +94,6 @@ typedef struct SilenceRemoveContext { · 93 unmodified lines | ||
| 94 | 94 | int64_t window_duration; |
| 95 | 95 | double sum; |
| 96 | 96 | |
| 97 | − int threshold; | |
| 98 | 97 | int one_period; |
| 99 | 98 | int restart; |
| 100 | 99 | int64_t next_pts; |
| @@ -435,7 +434,6 @@ static int config_input(AVFilterLink *inlink) · 334 unmodified lines | ||
| 435 | 434 | AVFilterContext *ctx = inlink->dst; |
| 436 | 435 | SilenceRemoveContext *s = ctx->priv; |
| 437 | 436 | |
| 438 | − s->threshold = -1; | |
| 439 | 437 | s->next_pts = AV_NOPTS_VALUE; |
| 440 | 438 | s->window_duration = av_rescale(s->window_duration_opt, inlink->sample_rate, |
| 441 | 439 | AV_TIME_BASE); |
| @@ -629,10 +627,6 @@ silence_trim: · 187 unmodified lines | ||
| 629 | 627 | } |
| 630 | 628 | } |
| 631 | 629 | |
| 632 | − if (s->threshold >= 0) | |
| 633 | − s->one_period = s->threshold != threshold; | |
| 634 | − s->threshold = threshold; | |
| 635 | − | |
| 636 | 630 | if (threshold) { |
| 637 | 631 | for (j = 0; j < outlink->channels; j++) { |
| 638 | 632 | s->update(s, in, j, nb_samples_read); |
| @@ -646,7 +640,8 @@ silence_trim: · 7 unmodified lines | ||
| 646 | 640 | nb_samples_read++; |
| 647 | 641 | |
| 648 | 642 | if (s->start_holdoff_end >= s->start_duration) { |
| 649 | − s->start_found_periods += s->one_period; | |
| 643 | + s->start_found_periods += s->one_period >= 1; | |
| 644 | + s->one_period = 0; | |
| 650 | 645 | if (s->start_found_periods >= s->start_periods) { |
| 651 | 646 | s->mode = SILENCE_TRIM_FLUSH; |
| 652 | 647 | goto silence_trim_flush; |
| @@ -659,6 +654,7 @@ silence_trim: · 6 unmodified lines | ||
| 659 | 654 | } |
| 660 | 655 | } else { |
| 661 | 656 | s->start_holdoff_end = 0; |
| 657 | + s->one_period++; | |
| 662 | 658 | |
| 663 | 659 | for (j = 0; j < outlink->channels; j++) { |
| 664 | 660 | s->update(s, in, j, nb_samples_read); |
| @@ -755,13 +751,10 @@ silence_copy: · 90 unmodified lines | ||
| 755 | 751 | } |
| 756 | 752 | } |
| 757 | 753 | |
| 758 | − if (s->threshold >= 0) | |
| 759 | − s->one_period = s->threshold != threshold; | |
| 760 | − s->threshold = threshold; | |
| 761 | − | |
| 762 | 754 | if (threshold && s->stop_holdoff_end && !s->stop_silence) { |
| 763 | 755 | s->mode = SILENCE_COPY_FLUSH; |
| 764 | 756 | flush(s, out, outlink, &nb_samples_written, 0); |
| 757 | + s->one_period++; | |
| 765 | 758 | goto silence_copy_flush; |
| 766 | 759 | } else if (threshold) { |
| 767 | 760 | for (j = 0; j < outlink->channels; j++) { |
| @@ -774,6 +767,7 @@ silence_copy: · 6 unmodified lines | ||
| 774 | 767 | s->window_offset = 0; |
| 775 | 768 | nb_samples_read++; |
| 776 | 769 | nb_samples_written++; |
| 770 | + s->one_period++; | |
| 777 | 771 | } else if (!threshold) { |
| 778 | 772 | for (j = 0; j < outlink->channels; j++) { |
| 779 | 773 | s->update(s, in, j, nb_samples_read); |
| @@ -798,7 +792,8 @@ silence_copy: · 18 unmodified lines | ||
| 798 | 792 | s->stop_holdoff_end++; |
| 799 | 793 | |
| 800 | 794 | if (s->stop_holdoff_end >= s->stop_duration) { |
| 801 | − s->stop_found_periods += s->one_period; | |
| 795 | + s->stop_found_periods += s->one_period >= 1; | |
| 796 | + s->one_period = 0; | |
| 802 | 797 | if (s->stop_found_periods >= s->stop_periods) { |
| 803 | 798 | s->stop_holdoff_offset = 0; |
| 804 | 799 | s->stop_holdoff_end = 0; |
| @@ -826,6 +821,7 @@ silence_copy: · 21 unmodified lines | ||
| 826 | 821 | } |
| 827 | 822 | } |
| 828 | 823 | } |
| 824 | + s->one_period++; | |
| 829 | 825 | flush(s, out, outlink, &nb_samples_written, 0); |
| 830 | 826 | } else { |
| 831 | 827 | av_samples_copy(out->extended_data, in->extended_data, |