diff mbox

[FFmpeg-devel,2/2] avfilter: make frame writable before writing it

Message ID 1485617034-31431-2-git-send-email-mfcc64@gmail.com
State New
Headers show

Commit Message

Muhammad Faiz Jan. 28, 2017, 3:23 p.m. UTC
affect filters that set partial_buf_size
test-case
ffplay -i lavfi 'aevalsrc=sin(1000*t*t), aformat=sample_fmts=fltp, asplit [a][b];
[a] firequalizer=fixed=on, showcqt=s=1280x360 [a1];
[b] firequalizer=fixed=on, showcqt=s=1280x360 [b1];
[a1][b1] vstack'

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
---
 libavfilter/avfilter.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

wm4 Jan. 28, 2017, 3:34 p.m. UTC | #1
On Sat, 28 Jan 2017 22:23:54 +0700
Muhammad Faiz <mfcc64@gmail.com> wrote:

> affect filters that set partial_buf_size
> test-case
> ffplay -i lavfi 'aevalsrc=sin(1000*t*t), aformat=sample_fmts=fltp, asplit [a][b];
> [a] firequalizer=fixed=on, showcqt=s=1280x360 [a1];
> [b] firequalizer=fixed=on, showcqt=s=1280x360 [b1];
> [a1][b1] vstack'
> 
> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
> ---
>  libavfilter/avfilter.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index c8dafd2..55c653d 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -1235,6 +1235,11 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
>          frame = ff_framequeue_peek(&link->fifo, 0);
>          av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n,
>                          link->channels, link->format);
> +
> +        ret = ff_inlink_make_frame_writable(link, frame);
> +        if (ret < 0)
> +            return ret;
> +
>          frame->nb_samples -= n;
>          av_samples_copy(frame->extended_data, frame->extended_data, 0, n,
>                          frame->nb_samples, link->channels, link->format);

Obviously OK.
diff mbox

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c8dafd2..55c653d 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1235,6 +1235,11 @@  static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
         frame = ff_framequeue_peek(&link->fifo, 0);
         av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n,
                         link->channels, link->format);
+
+        ret = ff_inlink_make_frame_writable(link, frame);
+        if (ret < 0)
+            return ret;
+
         frame->nb_samples -= n;
         av_samples_copy(frame->extended_data, frame->extended_data, 0, n,
                         frame->nb_samples, link->channels, link->format);