From patchwork Tue Mar 24 17:38:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1260844 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Rl0UkNS9; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48mz5H51ysz9sPR for ; Wed, 25 Mar 2020 04:39:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7E98B88650; Tue, 24 Mar 2020 17:39:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uhay2l9fkLI7; Tue, 24 Mar 2020 17:39:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B984288683; Tue, 24 Mar 2020 17:39:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 3BC731BF344 for ; Tue, 24 Mar 2020 17:39:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 32D7A88689 for ; Tue, 24 Mar 2020 17:39:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d0NjqAJLYMg2 for ; Tue, 24 Mar 2020 17:39:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by hemlock.osuosl.org (Postfix) with ESMTPS id C29B188353 for ; Tue, 24 Mar 2020 17:39:01 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id a23so7701276plm.1 for ; Tue, 24 Mar 2020 10:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kIVeYKp/COPLY74sxYwoo/E4GwRZsjbStIKL/EQ3ODU=; b=Rl0UkNS9Ny93mOD6kbgiwfWETqfgjfEXIC1wbTVMtlvPlxWTH49xG7LuX9jMf7WKJL H8QiL0V3lXLBCWh/gjEOTg/SLVESSOrWmESY5MMS9gUG4GtvrjCHya9RD/L3LfPbTvP3 IKjIHJgMRMFoKm61cqvzFaEhZKuWknqZoflT96a0WCh1LHQIsWq6tbMP9HfIiEkjYMgh HsMzikgD4go/CPIRM7jToy7GeGOGRrH/3vDxwuWZV1Zf5UWpNUDNbLLFHqx792M8J6Mx iqu4vkmWCiA/yH9ZjqhIuZ02sbSdi6Cn2Mn6XgHb3HAPPEzTqfNu1rT1Yz+kHLCxykQ1 B9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kIVeYKp/COPLY74sxYwoo/E4GwRZsjbStIKL/EQ3ODU=; b=cQHa0RYmfGszgjhO3CUbDd8MhXaJUzOlcMgMCWqsoDIlEubFbgvDwbkBZvcIt8t2qL SoXh/4ifupkJMwAaL4TR+2LESBj6c0vEJ0P05nskKz4UvYi6vl0T1D6Gx0bkGXLwQzkI +1Am24kW41g75EV16ifSkfGwbIQJH5SfxW/qK+4MKnOrWprscHwgeqXnREcTAYs6V+Qd ETQUH5KXKZpGiANvV5nsi2Yrp355pn0xBTSMzXS+DfVhk9uYFNBDg3FTlx+tKG6ElTlE HC0wZpCSMl1bAWDpkB4dHa0BxRCLIRBatijGV3Tt0vQptscohbR2jNQqdwIzO3StpnQW FLwA== X-Gm-Message-State: ANhLgQ1X7HwD8/1EVmIg0yBk9d6ylWMad1V8BHVFu8aMSZy+pojg/Eso lhDyT/C0TCa8//HNulpqYIQKWSzQ X-Google-Smtp-Source: ADFU+vu8BDXDrWXUayaOoJ5VfCG4mgygkW1wfMnzFycoijUznpjNXjPRVlpeK0XtpmzCnu5hVD2hKg== X-Received: by 2002:a17:90a:fc8c:: with SMTP id ci12mr6596259pjb.152.1585071541049; Tue, 24 Mar 2020 10:39:01 -0700 (PDT) Received: from localhost.localdomain ([47.149.8.172]) by smtp.gmail.com with ESMTPSA id v25sm12194425pgl.55.2020.03.24.10.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 10:39:00 -0700 (PDT) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Tue, 24 Mar 2020 10:38:54 -0700 Message-Id: <20200324173855.747054-3-aduskett@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324173855.747054-1-aduskett@gmail.com> References: <20200324173855.747054-1-aduskett@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/3] support/testing/tests/package/sample_gst1_python.py: fix test X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adam Duskett , Ricardo Martincoski Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Adam Duskett This commit fixes the following issues: - No call to main. - using autovideosink instead of fakevideosink. Using Fakevideoskink is preferred because its primary purpose is for debugging and sample pipelines. Autovideosink does not work because there is no video output device. - No function on_message. Without this function, the script fails because of the missing function. - The script sets the pipeline to Gst.State.EOS instead of Gst.State.NULL which results in a failed pipeline state. When the state is set to NULL, gstreamer automatically calls EOS. Manually setting the pipeline state to EOS results in the following error: Trying to dispose element sink, but it is in PLAYING instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. A refcounting bug may also cause this problem in the application or some element. These issues are now properly fixed, and the sample script passes. Signed-off-by: Adam Duskett --- .../tests/package/sample_gst1_python.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/support/testing/tests/package/sample_gst1_python.py b/support/testing/tests/package/sample_gst1_python.py index 39107616ed..6ed57a168b 100644 --- a/support/testing/tests/package/sample_gst1_python.py +++ b/support/testing/tests/package/sample_gst1_python.py @@ -1,20 +1,31 @@ #!/usr/bin/env python -"""A simple test that uses gst1-python to run a fake videotestsrc for 100 frames""" +"""A simple test that uses gst1-python to run a fake videotestsrc for 100 +frames +""" import sys import gi gi.require_version('Gst', '1.0') from gi.repository import Gst, GLib # noqa: E402 +def on_message(bus: Gst.Bus, message: Gst.Message, loop: GLib.MainLoop): + if message.type == Gst.MessageType.EOS: + loop.quit() + return True + + def main(): # Initializes Gstreamer Gst.init(sys.argv) - pipeline = Gst.parse_launch("videotestsrc num-buffers=100 ! autovideosink") + pipeline = Gst.parse_launch("videotestsrc num-buffers=100 ! fakevideosink") bus = pipeline.get_bus() bus.add_signal_watch() pipeline.set_state(Gst.State.PLAYING) loop = GLib.MainLoop() bus.connect("message", on_message, loop) loop.run() - pipeline.set_state(Gst.State.EOS) - exit(0) + pipeline.set_state(Gst.State.NULL) + + +if __name__ == '__main__': + main()