GNOME Bugzilla – Bug 760550
parse-launch: improve possibly misleading error message when linking two elements with filter caps
Last modified: 2017-01-18 13:44:52 UTC
I want to convert an audio file to raw: gst-launch-1.0 filesrc location=foo.wav ! wavparse ! audioconvert ! "audio/x-raw,channels=1,rate=44100,format=S16" ! filesink location=foo.raw The mistake above is that S16 is not a valid format, it should be e.g. S16LE. What gst-launch prints is "WARNING: erroneous pipeline: could not link audioconvert0 to filesink0" This is very unfortunate and misleading, since filesink takes any caps. I think we are missing some error handling and this disguises the root cause.
The focus on filesink is something that's your personal interpretation of the error message though, I think the message is perfectly correct, it doesn't say if the problem is with audioconvert or filesink after all. Having said that, if it could provide more details of what's wrong exactly, that'd be very useful.
More detail: 0:00:00.197011349 30324 0x159ba00 ERROR GST_PIPELINE grammar.y:642:gst_parse_perform_link: could not link audioconvert0 to filesink0 WARNING: erroneous pipeline: could not link audioconvert0 to filesink0 Its probably comming from using gst_element_link_filtered(). But anyway the link from audioconvert0 to the caps filter failed. Linking to filesink0 cannot fail by design, hence the message is misleading. I filed this because I think we can do better and leave less room to interpretation.
Created attachment 339668 [details] [review] parse: better error message when linking two elements with capsfilter fails First stab at this. Far from perfect, but does something. $ gst-launch-1.0 audiotestsrc ! ximagesink WARNING: could not link audiotestsrc0 to ximagesink0 $ gst-launch-1.0 audiotestsrc ! audio/x-raw ! ximagesink WARNING: could not link audiotestsrc0 to ximagesink0, ximagesink0 can't handle caps audio/x-raw $ gst-launch-1.0 audiotestsrc ! audio/mpeg ! ximagesink WARNING: could not link audiotestsrc0 to ximagesink0, neither element can handle caps audio/mpeg $ gst-launch-1.0 audiotestsrc ! video/x-raw ! ximagesink WARNING: could not link audiotestsrc0 to ximagesink0, audiotestsrc0 can't handle caps video/x-raw $ gst-launch-1.0 audiotestsrc ! audio/x-raw,format=S16 ! fakesink WARNING: could not link audiotestsrc0 to fakesink0, audiotestsrc0 can't handle caps audio/x-raw, format=(string)S16 We might still/also want a more general try_and_figure_out_why_two_elements_cant_link() function, so we can have a more useful debug message in our debug logs when linking fails outside of parse launch.
Comment on attachment 339668 [details] [review] parse: better error message when linking two elements with capsfilter fails Looks like a good start to me :)
commit 89b413ef153fc7aa2bbcc1a76c18bda860d5bda1 Author: Tim-Philipp Müller <tim@centricular.com> Date: Fri Nov 11 20:31:03 2016 +0000 parse: better error message when linking two elements with capsfilter fails https://bugzilla.gnome.org/show_bug.cgi?id=760550
Thanks! Wonder if we want this in gst_utils? I have something a bit similar in buzztrax: https://github.com/Buzztrax/buzztrax/blob/master/src/lib/core/tools.c#L532
I think we want something that takes inspiration from both and at least use it as an internal helper when printing link failure debug log messages, and then we can see if we want to expose it too. The code just added to gstparse might be special because of the filter caps thing which most other link code doesn't have (I think), so that code probably needs to work a bit differently.
This caused a deadlock, see https://bugzilla.gnome.org/show_bug.cgi?id=777449