<div dir="ltr"><div dir="ltr">On Mon, 21 Sep 2020 at 17:10, Sebastian Dröge <<a href="mailto:sebastian@centricular.com">sebastian@centricular.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, 2020-09-21 at 16:55 +0100, Tony Houghton wrote:<br>
> The first is that if I<br>
> call Gst.init(ARGV) it crashes with an attempt to free a block of<br>
> memory that isn't freeable. I solved that by simply passing null<br>
> instead, and I guess I could find a workaround if I really do need it<br>
> to process ARGV.<br>
<br>
Can you report that to gjs? That would be a bug on the bindings side<br>
<a href="https://gitlab.gnome.org/GNOME/gjs" rel="noreferrer" target="_blank">https://gitlab.gnome.org/GNOME/gjs</a></blockquote><div><br></div><div>OK, I've done that: <a href="https://gitlab.gnome.org/GNOME/gjs/-/issues/350">https://gitlab.gnome.org/GNOME/gjs/-/issues/350</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> First, note that although the API docs say you need to use<br>
> add_watch_full(), AFAICT you actually have to use add_watch() with<br>
> arguments as for add_watch_full(), because the latter doesn't exist<br>
> in gjs. This is something to do with the 'full' version shadowing the<br>
> other, which I don't fully understand, but I managed to work it out<br>
> by looking at the output of ts-for-gjs.<br>
<br>
That seems like a problem in the documentation indeed. The non-full<br>
version is not usable from bindings, so the full version is configured<br>
to shadow/hide the non-full one.<br>
<br>
Where is that in the documentation? Can you create an issue for that at<br>
<a href="https://gitlab.freedesktop.org/gstreamer/gst-docs/" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-docs/</a></blockquote><div><br></div><div>I've reported that too. I've included a link to the page where I found the mistake in my report: <a href="https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/72">https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/72</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> The main problem though is that the pipeline only runs for a few<br>
> seconds, then crashes with this error:<br>
> <br>
> Trying to dispose element inputselector2, but it is in PLAYING<br>
> instead of the NULL state.<br>
> <br>
> I haven't tested whether this is specific to gjs, or also occurs in<br>
> python or even C, but I get the same error in OS X as well as Arch<br>
> Linux. Both are using gstreamer 1.18.0.<br>
<br>
Your code doesn't have any main loop or similar, so after setting the<br>
pipeline to PLAYING it simply exits. You probably want to wait in one<br>
way or another until the EOS (or ERROR) message is received from the<br>
bus.<br></blockquote><div><br></div><div>Sorry, my code does include a GMainLoop, but I missed it out here for brevity. Without the watch callback my code seems to work OK, but with the callback it only runs for a few seconds (it does open a window and play back the stream for a while) before stopping with the above error.</div><div><br></div><div>I've tried a few other things. Equivalents in C and python both run successfully. The Javascript version also runs OK if I use <font color="#741b47">add_signal_watch() </font><font color="#000000">instead of</font><font color="#741b47"> add_watch()</font><font color="#000000">. So I think the problem is that gjs can't cope with a callback being called off the main thread. This could theoretically cause problems in python too, but I presume it works either because this has been addressed in its custom Gst bindings, or at a lower level. I'm writing a companion library in introspectable C for my app, so if I need synchronous callbacks for something like embedding video in a window of my choice, I can probably add support functions in the library.</font></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">TH<div><br></div></div></div></div>