diff mbox

[FFmpeg-devel,2/5] examples/filtering_video: drop an always true condition

Message ID 20180514121802.14519-2-quinkblack@foxmail.com
State New
Headers show

Commit Message

Zhao Zhili May 14, 2018, 12:17 p.m. UTC
From: Zhao Zhili <wantlamy@gmail.com>

---
 doc/examples/filtering_video.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

Comments

Michael Niedermayer May 15, 2018, 8:03 p.m. UTC | #1
On Mon, May 14, 2018 at 08:17:59PM +0800, Zhao Zhili wrote:
> From: Zhao Zhili <wantlamy@gmail.com>
> 
> ---
>  doc/examples/filtering_video.c | 34 ++++++++++++++++------------------
>  1 file changed, 16 insertions(+), 18 deletions(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 225dccc..170a675 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -248,27 +248,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);
             }
         } else {
             av_packet_unref(&packet);