From patchwork Tue Sep 3 01:02:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 14858 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A4657449F2B for ; Tue, 3 Sep 2019 04:03:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 913AB687FAC; Tue, 3 Sep 2019 04:03:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6ADBA687F98 for ; Tue, 3 Sep 2019 04:03:12 +0300 (EEST) Received: by mail-ot1-f65.google.com with SMTP id 90so11177056otg.10 for ; Mon, 02 Sep 2019 18:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mVsEUrdsXDeDF7Z149Ur6mx8sYCTdPieRRgYN3GyTn4=; b=0ESYwzsfanjlPph/pfWpwg7kX2Zscm4aszz+wsUcBznf2wXPHsRWwkVdpuK4ljoBd5 p2FrVoeyNx/t5+xf7XoV7g0pv8GvbYzJp1cOndisbkpHQpQoIwftHYDCnxP+ObmKGFKF EshYPiQAFEaC4M5ZwaHcen+z3B7cPu0X9AtGjCm0doAEgUck2lAxMGZhj7b5fuBZMLen nvuR2HUA977fQKd+3CBBr5LV18WjBHCcT0rkgNVD6vGv64WzV+wfZDm/gFqktyCrsQlB T75Uyj8nB4WLtpAh/CcUP/a0tvD8U36oS+9FDLvMndIWRkUz0Nc4vTU8OESLyoQHgaT2 7xFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mVsEUrdsXDeDF7Z149Ur6mx8sYCTdPieRRgYN3GyTn4=; b=PyJK/9UgNxIVIFi/lUpt1r7DO3KLSRMUixpWDZk+Mn+QlhQPoMtxbWdWNEV8fWXT7U UF2hcxVgZ9ZPHlWhmIYCf8nD58yqxLYntBZNS9+C3eTyv88AhjWeDA/FgbNalA09yqmA 83XWSiVM2K8en0dxLvI+vdQ6WDnvw7WdUx61QyRb6pnaQjOw8Uw2Tzc1f728wJvT2/nB HvTH62ABzU75KHVSBCcW/SH6Ds1/ATcl+CI4W5sIYMDWk6tEhHq8zcoqPhTIYPaV+eQr V5f6MKWk9TYaWb6XtD3fHaYvzNSH70QPlazSkv3psN+U2pq4t+eSTRLNMK0JgnDwhn6H 0hMA== X-Gm-Message-State: APjAAAVQ03gcPSclO8LB1b5I+6cn4RzShor7FtTFERhSYOENZdT5zOCb Vir7gFh13lDaXT7Gea3ewl7ToB4rkj8= X-Google-Smtp-Source: APXvYqyGZxfKA2jWdkpk6AZ1tQpME944vjd73V3h3qXzD+82DkYNB/OtcERrxZB+fY42Yk4QdNXxAA== X-Received: by 2002:a05:6830:22d0:: with SMTP id q16mr4237672otc.89.1567472590842; Mon, 02 Sep 2019 18:03:10 -0700 (PDT) Received: from tmm1-imac.lan (ip184-189-221-177.sb.sd.cox.net. [184.189.221.177]) by smtp.gmail.com with ESMTPSA id a21sm4299633oie.9.2019.09.02.18.03.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Sep 2019 18:03:10 -0700 (PDT) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Sep 2019 18:02:19 -0700 Message-Id: <20190903010230.96236-15-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903010230.96236-1-ffmpeg@tmm1.net> References: <20190903010230.96236-1-ffmpeg@tmm1.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/25] avcodec/v4l2_buffers: read height/width from the proper context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: lorusak@gmail.com, Aman Gupta , jorge.ramirez.ortiz@gmail.com, Aman Gupta Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta Frames are generally dequeued into capture buffers, so using the output properties here was incorrect. It happened to work fine for decoding, since the output/capture buffers have the same dimensions. For the v4l2 scaler, the dimensions can be different between output and capture. Using the buffer's associated context makes this code work correctly regardless of where the frame is coming from. Signed-off-by: Aman Gupta --- libavcodec/v4l2_buffers.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index f90c50db80..46c9f11d7b 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -404,7 +404,6 @@ int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out) int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) { - V4L2m2mContext *s = buf_to_m2mctx(avbuf); int ret; av_frame_unref(frame); @@ -424,8 +423,8 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) frame->pkt_dts = AV_NOPTS_VALUE; /* these two values are updated also during re-init in v4l2_process_driver_event */ - frame->height = s->output.height; - frame->width = s->output.width; + frame->height = avbuf->context->height; + frame->width = avbuf->context->width; /* 3. report errors upstream */ if (avbuf->buf.flags & V4L2_BUF_FLAG_ERROR) {