From patchwork Tue Jun 23 19:08:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 4188 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9877C609A5 for ; Tue, 23 Jun 2020 21:09:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p7uhQ8iL"; dkim-atps=neutral Received: from jade.rasen.tech (unknown [IPv6:2400:4051:61:600:8147:f2a2:a8c6:9087]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C0A02A9; Tue, 23 Jun 2020 21:09:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1592939376; bh=GXpAoz46hAsjPUdtZVPdEf6WbB5+Y2BFhz0HiD/eles=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p7uhQ8iLHZbmK3qijYVNNR584+tfthIjc05cFCsuI7FnGizAbdv5KJonQynazpfD5 Kn2Vhn4e4y59h0GlNBoS5YnmtnGwwJVTyB5b5SNXwGBVwFJuRRIaZfsThz10lM++18 ckxhqlY7C8xaDd9RHbt8sL4fffcRAW6bje8rn/KA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 24 Jun 2020 04:08:28 +0900 Message-Id: <20200623190836.53446-15-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623190836.53446-1-paul.elder@ideasonboard.com> References: <20200623190836.53446-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 14/22] v4l2: v4l2_camera_proxy: noop if streamon when stream is already on X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 19:09:36 -0000 If VIDIOC_STREMAON is called when the stream is already on, do a noop. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v3: - move isRunning check to after ownership check New in v2: (split from "v4l2: v4l2_camera: Add isRunning()") --- src/v4l2/v4l2_camera_proxy.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 0c7232d..06fef21 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -628,6 +628,9 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg) if (!hasOwnership(file)) return -EBUSY; + if (vcam_->isRunning()) + return 0; + currentBuf_ = 0; return vcam_->streamOn();