Implement it using av_buffersrc_add_ref.
Showing the changes to libavfilter/src_buffer.c (1 of 1 file). Show all
Unified · Split
| @@ -570,27 +570,7 @@ int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *ctx, · 569 unmodified lines | ||
| 570 | 570 | AVFilterBufferRef *samplesref, |
| 571 | 571 | int av_unused flags) |
| 572 | 572 | { |
| 573 | − BufferSourceContext *abuffer = ctx->priv; | |
| 574 | − int ret; | |
| 575 | − | |
| 576 | − if (av_fifo_space(abuffer->fifo) < sizeof(samplesref)) { | |
| 577 | − av_log(ctx, AV_LOG_ERROR, | |
| 578 | − "Buffering limit reached. Please consume some available frames " | |
| 579 | − "before adding new ones.\n"); | |
| 580 | − return AVERROR(EINVAL); | |
| 581 | − } | |
| 582 | − | |
| 583 | − ret = check_format_change(ctx, samplesref); | |
| 584 | − if (ret < 0) | |
| 585 | − return ret; | |
| 586 | − | |
| 587 | − if (sizeof(samplesref) != av_fifo_generic_write(abuffer->fifo, &samplesref, | |
| 588 | − sizeof(samplesref), NULL)) { | |
| 589 | − av_log(ctx, AV_LOG_ERROR, "Error while writing to FIFO\n"); | |
| 590 | − return AVERROR(EINVAL); | |
| 591 | − } | |
| 592 | − | |
| 593 | − return 0; | |
| 573 | + return av_buffersrc_add_ref(ctx, samplesref, AV_BUFFERSRC_FLAG_NO_COPY); | |
| 594 | 574 | } |
| 595 | 575 | |
| 596 | 576 | int av_asrc_buffer_add_samples(AVFilterContext *ctx, |