rtspsrc: Fix accumulation of before-send signal return values
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 17 Mar 2021 07:48:34 +0000 (13:18 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Wed, 17 Mar 2021 08:35:44 +0000 (14:05 +0530)
commit73fb107a855910e3ff8558fd14ba5233a314fb13
tree3e6540ab708d655b7f113b1558ef45ff709ecbec
parent55edd59f4822283c7a1f8491c18396fa4858b446
rtspsrc: Fix accumulation of before-send signal return values

Since glib 2.62, the accumulated return values in RUN_CLEANUP override the
accumulated return values in RUN_FIRST. Since:

1. We have a default handler that always returns TRUE, and
2. User handlers are only run in RUN_FIRST, and
3. Our accumulator just takes the latest return value

We were discarding the return value from the user handler and always
sending messages even if the user handler said not to. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2352 for more details.

This signal does not need RUN_CLEANUP or RUN_FIRST, so just change it
to RUN_LAST so that it's emitted exactly once and accumulated once.

With this fix, this signal can now be used to intercept PAUSE when
going to GST_STATE_NULL so that the server does a TEARDOWN (if
necessary) and not a PAUSE, which will confuse other RTSP clients when
playing shared media.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/909>
gst/rtsp/gstrtspsrc.c