From 4459d706c89f6b6535e3f734f4e6cae9b785f926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 9 Mar 2015 22:02:38 +0100 Subject: [PATCH] avviddec: Don't copy padding if handling a frame failed We will return an error right afterwards anyway. --- ext/libav/gstavviddec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 4689d57d98..83df91774a 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1540,18 +1540,18 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder, len = gst_ffmpegviddec_frame (ffmpegdec, data, size, &have_data, frame, &ret); - if (do_padding) { - memcpy (data + size, tmp_padding, FF_INPUT_BUFFER_PADDING_SIZE); - } - if (ret != GST_FLOW_OK) { GST_LOG_OBJECT (ffmpegdec, "breaking because of flow ret %s", gst_flow_get_name (ret)); - /* bad flow retun, make sure we discard all data and exit */ + /* bad flow return, make sure we discard all data and exit */ bsize = 0; break; } + if (do_padding) { + memcpy (data + size, tmp_padding, FF_INPUT_BUFFER_PADDING_SIZE); + } + if (len == 0 && have_data == 0) { /* nothing was decoded, this could be because no data was available or * because we were skipping frames.