A weird issue with rtsp streaming + Qt qml sink on Yocto

A rtsp pipeline is created in a C++ class with rtspsrc + dynamic pad(detect H264/265). After pipeline is started and pad shows up, a sink bin is assembled with the proper decoder + qml sink and added to the pipeline. Streaming works just fine on the QML GUI.
However, the following error appears:
GLib-CRITICAL **: 19:02:47.627: g_source_attach: assertion ‘source != NULL’ failed
in the call gst_element_sync_state_with_parent:
gst_bin_add( GST_BIN( m_pipeline ), m_videoSinkBin );
if ( false == gst_element_sync_state_with_parent(m_videoSinkBin) ) {
}
although gst_element_sync_state_with_parent returns true.

Another error message is:
Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

This problem is caused by the fact that a different thread from qt main thread is running for adding pad and sink bin with qml sink.

The streaming display is all right in spite of these two error messages.

Managed to trigger a slot call to use qt main thread to add sink bin with qml sink. The second error is gone.

But the first error is still there, And streaming is not working any more and a black screen is displayed. A new error message:
Bus errors: “Internal data stream error.”
This is on Yocto with decoders imxvpudec_h264/5.

The same workflow with different decoders vah264/5dec does not have any issue on Ubuntu 22.04 although the second error should show up there as well. But it does not.

Gstreamer version is 1.22.5. Qt version 5.15.3.