Showing the changes to libavfilter/vsrc_buffer.c (1 of 2 files). Show all
Unified · Split
| @@ -40,6 +40,7 @@ typedef struct { · 39 unmodified lines | ||
| 40 | 40 | AVRational sample_aspect_ratio; |
| 41 | 41 | char sws_param[256]; |
| 42 | 42 | int eof; |
| 43 | + unsigned nb_failed_requests; | |
| 43 | 44 | } BufferSourceContext; |
| 44 | 45 | |
| 45 | 46 | #define CHECK_PARAM_CHANGE(s, c, width, height, format)\ |
| @@ -123,6 +124,7 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter, · 77 unmodified lines | ||
| 123 | 124 | avfilter_unref_buffer(buf); |
| 124 | 125 | return ret; |
| 125 | 126 | } |
| 127 | + c->nb_failed_requests = 0; | |
| 126 | 128 | |
| 127 | 129 | return 0; |
| 128 | 130 | } |
| @@ -147,6 +149,7 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) · 18 unmodified lines | ||
| 147 | 149 | |
| 148 | 150 | if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) |
| 149 | 151 | return ret; |
| 152 | + c->nb_failed_requests = 0; | |
| 150 | 153 | |
| 151 | 154 | return 0; |
| 152 | 155 | } |
| @@ -178,6 +181,11 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, · 25 unmodified lines | ||
| 178 | 181 | } |
| 179 | 182 | #endif |
| 180 | 183 | |
| 184 | +unsigned av_vsrc_buffer_get_nb_failed_requests(AVFilterContext *buffer_src) | |
| 185 | +{ | |
| 186 | + return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests; | |
| 187 | +} | |
| 188 | + | |
| 181 | 189 | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) |
| 182 | 190 | { |
| 183 | 191 | BufferSourceContext *c = ctx->priv; |
| @@ -249,6 +257,7 @@ static int request_frame(AVFilterLink *link) · 65 unmodified lines | ||
| 249 | 257 | if (!av_fifo_size(c->fifo)) { |
| 250 | 258 | if (c->eof) |
| 251 | 259 | return AVERROR_EOF; |
| 260 | + c->nb_failed_requests++; | |
| 252 | 261 | return AVERROR(EAGAIN); |
| 253 | 262 | } |
| 254 | 263 | av_fifo_generic_read(c->fifo, &buf, sizeof(buf), NULL); |