Bus error messages do not show up in callback func

The same piece of code

        const auto bus = gst_pipeline_get_bus( GST_PIPELINE ( pipeline ) );
        gst_bus_add_signal_watch( bus );
        g_signal_connect( bus, "message", G_CALLBACK( &MyClient::onBusError ), this );

is used in two RTSP streaming apps on Yocto and Ubuntu. The app on Ubuntu displays the error messages. But the app on Yocto does not catch the error messages although the error messages are displayed on the screen. Is any plugin missing or any flags are needed? What causes this issue? Any help is appreciated.

Do you use Qt by any chance? Using the bus watches requires using a GLib main loop (and in this case on the default main context). Ubuntu’s Qt is compiled with GLib support (which runs a GLib main loop by default then), while on Yocto you need to enable that yourself when compiling Qt.

The alternative would be to not use the bus watches but any of the other many ways to get bus messages.

1 Like

Thank for your reply, Sebastian. True that this is a Qt app. However, Qt is from Yocto distribution and not compiled by myself. I am not sure if it is enabled or not. I will check it out.

objdump -x libQt5Core.so.5.15.13 | grep NEEDED
NEEDED libz.so.1
NEEDED libpcre2-16.so.0
NEEDED libzstd.so.1
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libgcc_s.so.1
NEEDED libc.so.6
NEEDED ld-linux-aarch64.so.1

It looks like GLib is not enabled. It is pretty messy to build Qt. Any easy alternative to recommend? Thanks.

True that glib is enabled on Ubuntu.
objdump -x /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.3 | grep NEEDED
NEEDED libz.so.1
NEEDED libdouble-conversion.so.3
NEEDED libicui18n.so.70
NEEDED libicuuc.so.70
NEEDED libpcre2-16.so.0
NEEDED libzstd.so.1
NEEDED libglib-2.0.so.0
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libgcc_s.so.1
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2

You could integrate it with the Qt event loop via the bus’s sync handler, or by making use of the fd the bus can provide for whenever a message is available (it becomes readable then).

1 Like

Will try it out. Thanks a lot.

1 Like