* qatar/master: FATE: fix the asyncts test build: Drop gcc-specific warning flag from header compilation rule FATE: add a test for the asyncts audio filter. matroskadec: return more correct error code on read error. buffersrc: check ff_get_audio_buffer() for errors. lavfi: check all ff_get_video_buffer() calls for errors. lavfi: check all avfilter_ref_buffer() calls for errors. vf_select: avoid an unnecessary avfilter_ref_buffer(). buffersrc: avoid creating unnecessary buffer reference lavfi: use avfilter_unref_bufferp() where appropriate. vf_fps: add more error checks. vf_fps: fix a memleak on malloc failure. lavfi: check all ff_start_frame/draw_slice/end_frame calls for errors lavfi: add error handling to end_frame(). lavfi: add error handling to draw_slice(). lavfi: add error handling to start_frame(). Conflicts: Makefile ffplay.c libavfilter/buffersrc.c libavfilter/vf_boxblur.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_frei0r.c libavfilter/vf_hflip.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/video.c libavfilter/vsrc_color.c
Showing the changes to libavfilter/split.c (1 of 64 files). Show all
Unified · Split
| @@ -63,32 +63,47 @@ static void split_uninit(AVFilterContext *ctx) · 62 unmodified lines | ||
| 63 | 63 | av_freep(&ctx->output_pads[i].name); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | −static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) | |
| 66 | +static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) | |
| 67 | 67 | { |
| 68 | 68 | AVFilterContext *ctx = inlink->dst; |
| 69 | − int i; | |
| 69 | + int i, ret = 0; | |
| 70 | 70 | |
| 71 | − for (i = 0; i < ctx->nb_outputs; i++) | |
| 72 | − ff_start_frame(ctx->outputs[i], | |
| 73 | − avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); | |
| 71 | + for (i = 0; i < ctx->nb_outputs; i++) { | |
| 72 | + AVFilterBufferRef *buf_out = avfilter_ref_buffer(picref, ~AV_PERM_WRITE); | |
| 73 | + if (!buf_out) | |
| 74 | + return AVERROR(ENOMEM); | |
| 75 | + | |
| 76 | + ret = ff_start_frame(ctx->outputs[i], buf_out); | |
| 77 | + if (ret < 0) | |
| 78 | + break; | |
| 79 | + } | |
| 80 | + return ret; | |
| 74 | 81 | } |
| 75 | 82 | |
| 76 | −static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) | |
| 83 | +static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) | |
| 77 | 84 | { |
| 78 | 85 | AVFilterContext *ctx = inlink->dst; |
| 79 | − int i; | |
| 86 | + int i, ret = 0; | |
| 80 | 87 | |
| 81 | − for (i = 0; i < ctx->nb_outputs; i++) | |
| 82 | − ff_draw_slice(ctx->outputs[i], y, h, slice_dir); | |
| 88 | + for (i = 0; i < ctx->nb_outputs; i++) { | |
| 89 | + ret = ff_draw_slice(ctx->outputs[i], y, h, slice_dir); | |
| 90 | + if (ret < 0) | |
| 91 | + break; | |
| 92 | + } | |
| 93 | + return ret; | |
| 83 | 94 | } |
| 84 | 95 | |
| 85 | −static void end_frame(AVFilterLink *inlink) | |
| 96 | +static int end_frame(AVFilterLink *inlink) | |
| 86 | 97 | { |
| 87 | 98 | AVFilterContext *ctx = inlink->dst; |
| 88 | − int i; | |
| 99 | + int i, ret = 0; | |
| 89 | 100 | |
| 90 | − for (i = 0; i < ctx->nb_outputs; i++) | |
| 91 | − ff_end_frame(ctx->outputs[i]); | |
| 101 | + for (i = 0; i < ctx->nb_outputs; i++) { | |
| 102 | + ret = ff_end_frame(ctx->outputs[i]); | |
| 103 | + if (ret < 0) | |
| 104 | + break; | |
| 105 | + } | |
| 106 | + return ret; | |
| 92 | 107 | } |
| 93 | 108 | |
| 94 | 109 | AVFilter avfilter_vf_split = { |
| @@ -114,8 +129,14 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref) · 19 unmodified lines | ||
| 114 | 129 | int i, ret = 0; |
| 115 | 130 | |
| 116 | 131 | for (i = 0; i < ctx->nb_outputs; i++) { |
| 117 | − ret = ff_filter_samples(inlink->dst->outputs[i], | |
| 118 | − avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE)); | |
| 132 | + AVFilterBufferRef *buf_out = avfilter_ref_buffer(samplesref, | |
| 133 | + ~AV_PERM_WRITE); | |
| 134 | + if (!buf_out) { | |
| 135 | + ret = AVERROR(ENOMEM); | |
| 136 | + break; | |
| 137 | + } | |
| 138 | + | |
| 139 | + ret = ff_filter_samples(inlink->dst->outputs[i], buf_out); | |
| 119 | 140 | if (ret < 0) |
| 120 | 141 | break; |
| 121 | 142 | } |