After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759019 - gst-launch-1.0 returns 0 exit code on async error during playback
gst-launch-1.0 returns 0 exit code on async error during playback
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.6.1
Other Linux
: Normal normal
: 1.6.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-04 11:00 UTC by Florent Thiéry
Modified: 2015-12-04 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gst-launch: Fix process return value on error (920 bytes, patch)
2015-12-04 15:25 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description Florent Thiéry 2015-12-04 11:00:38 UTC
I'm testing a UVC webcam, and i get a flow error (which is fine); what isn't, is that the return code is 0.


$ LANG=C gst-launch-1.0 v4l2src num-buffers=1 ! "video/x-raw, width=(int)1920, height=(int)1200, framerate=(fraction)25/1" ! fakesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 0:00:00.020056914
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
$ echo $?
0
Comment 1 Sebastian Dröge (slomo) 2015-12-04 14:10:00 UTC
From the code it looks like all code paths that somehow handle ERROR messages would cause non-0 to be returned from main(). I can't reproduce this problem here.

Can you follow the code in your case and maybe even provide a patch? :)
Comment 2 Florent Thiéry 2015-12-04 14:19:40 UTC
Funnily, 

$ LANG=C gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw\,\ format\=\(string\)BGRx\,\ width\=\(int\)3841\,\ height\=\(int\)1321\,\ framerate\=\(fraction\)216/1\,\ pixel-aspect-ratio\=\(fraction\)12/1\,\ interlace-mode\=\(string\)progressive ! ximagesink
$ echo $?
1

So it seems restricted to v4l2src indeed.
Comment 3 Florent Thiéry 2015-12-04 14:51:44 UTC
Take any v4l2 device, ask for unsupported caps, and here you go:
$ gst-launch-1.0 v4l2src num-buffers=1 ! "video/x-raw, width=(int)3840, height=(int)2160, framerate=(fraction)60/1" ! fakesink
$ echo $?
0

I'll try to reproduce with vivid though.
Comment 4 Nicolas Dufresne (ndufresne) 2015-12-04 15:06:12 UTC
No need, I can reproduce here too.
Comment 5 Tim-Philipp Müller 2015-12-04 15:12:57 UTC
Has nothing to do with v4l2src, can be reproduced with:

gst-launch-1.0 fakesrc ! identity error-after=5 ! fakesink ; echo $?


commit 2ee4cba2485d7f1646d48e4559426aed4ba99c85
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Fri Dec 4 15:09:39 2015 +0000

    tools: gst-launch: return non-0 exit code on async error
    
    When an error happens in playing state, still return a
    non-0 exit code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759019
Comment 6 Nicolas Dufresne (ndufresne) 2015-12-04 15:25:17 UTC
Created attachment 316777 [details] [review]
gst-launch: Fix process return value on error

In case of a run-time error message, the process return value was left
unset. This would lead to error not being caught at shell level.
Comment 7 Nicolas Dufresne (ndufresne) 2015-12-04 15:26:29 UTC
Hmm, ok. I thought my message was enough, oh well.
Comment 8 Nicolas Dufresne (ndufresne) 2015-12-04 15:26:44 UTC
Please backport to stable branches.
Comment 9 Nicolas Dufresne (ndufresne) 2015-12-04 15:37:33 UTC
Comment on attachment 316777 [details] [review]
gst-launch: Fix process return value on error

In fact the pushed code ignores the "ignore_errors" boolean from the EOS (-e) case. Please consider.
Comment 10 Tim-Philipp Müller 2015-12-04 15:46:50 UTC
Yes, I agree, push yours please, thanks.
Comment 11 Nicolas Dufresne (ndufresne) 2015-12-04 15:55:57 UTC
Also on 1.6:

commit 057fc558359c63b212d596179cb0a0b658142010
Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Date:   Fri Dec 4 10:22:56 2015 -0500

    gst-launch: Fix process return value on error
    
    In case of a run-time error message, the process return value was left
    unset. This would lead to error not being caught at shell level.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759019