]> git.sesse.net Git - ffmpeg/commitdiff
examples/filtering_video: drop an always true condition
authorZhao Zhili <wantlamy@gmail.com>
Mon, 14 May 2018 12:17:59 +0000 (20:17 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 15 May 2018 22:39:52 +0000 (00:39 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
doc/examples/filtering_video.c

index 38ff9bb7dbac1c6dfa3c8ce91c20b35cbaa4fa60..b2191251b5fc3a5b101d6f3c2e4e4625c1811ec8 100644 (file)
@@ -247,27 +247,25 @@ int main(int argc, char **argv)
                     goto end;
                 }
 
-                if (ret >= 0) {
-                    frame->pts = frame->best_effort_timestamp;
+                frame->pts = frame->best_effort_timestamp;
 
-                    /* push the decoded frame into the filtergraph */
-                    if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
-                        av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
+                /* push the decoded frame into the filtergraph */
+                if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
+                    av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
+                    break;
+                }
+
+                /* pull filtered frames from the filtergraph */
+                while (1) {
+                    ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
+                    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
                         break;
-                    }
-
-                    /* pull filtered frames from the filtergraph */
-                    while (1) {
-                        ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
-                        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
-                            break;
-                        if (ret < 0)
-                            goto end;
-                        display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base);
-                        av_frame_unref(filt_frame);
-                    }
-                    av_frame_unref(frame);
+                    if (ret < 0)
+                        goto end;
+                    display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base);
+                    av_frame_unref(filt_frame);
                 }
+                av_frame_unref(frame);
             }
         }
         av_packet_unref(&packet);