[FFmpeg-devel] [PATCHv3] avfilter/vf_framerate: always request input if no output is provided in request_frame

Marton Balint cus at passwd.hu
Sat Apr 15 15:06:33 EEST 2017



On Wed, 12 Apr 2017, Nicolas George wrote:

> Le tridi 23 germinal, an CCXXV, Marton Balint a écrit :
>> Note that the above code which I moved returns 0 if ff_request_frame returns
>> AVERROR_EOF. As far as I see, this can only happen a few times, not
>> infinitely, so I am not sure if this is an error or not, so I kept is as it
>> was before.
>
> There are exactly three acceptable behaviours for request_frame() and
> all the functions it calls:
>
> * it pushes a frame and returns 0;
>
> * it issues a ff_request_frame() on the input and returns 0;
>
> * it returns EOF or an error.
>
> If the "few times" correspond to frames pushed, then it is ok.
> Otherwise, it is not. lavfi will not activate filters saying "hey, you
> told me last time you had nothing to do, but just in case I am taking
> news". A filter should never do nothing.

Well, then I guess the doc/filtering_design.txt is outdated, because
it uses term "making progress towards producing a frame" when returning 0

There is also an example code snippet there:

         if (frames_queued) {
             push_one_frame();
             return 0;
         }
         input = input_where_a_frame_is_most_needed();
         ret = ff_request_frame(input);
         if (ret == AVERROR_EOF) {
             process_eof_on_input();
         } else if (ret < 0) {
             return ret;
         }
         return 0;

Am I getting this right, process_eof_on_input() should be extended to

process_eof_on_input();
if (!frames_queued)
     return AVERROR_EOF;
push_one_frame();

Regards,
Marton


More information about the ffmpeg-devel mailing list