gstrtspconnection: messages_bytes not decreased
The variable messages_bytes is not decreased when the write operation is only partly successful.
We see quite a lot of crashes (after upgrade to 1.16) with this call-stack: #5 0x76a37134 in g_assertion_message_expr (domain=0x0, file=0x76ef2d48 "../../../../gst-plugins-base-1.16.0/gst-libs/gst/rtsp/gstrtspconnection.c", line=line@entry=4002, func=0x76ef261c <func.45431> "gst_rtsp_source_dispatch_write", expr=0x76ef2e0c "watch->messages_bytes >= bytes_written", expr@entry=0x149adb8 "assertion failed: (watch->messages_bytes >= bytes_written)") at ../glib-2.60.5/glib/gtestutils.c:2904 #6 0x76eebb04 in gst_rtsp_source_dispatch_write (stream=, watch=) at ../../../../gst-plugins-base-1.16.0/gst-libs/gst/rtsp/gstrtspconnection.c:4002 #7 0x76a1c954 in g_main_dispatch (context=0x147d530) at ../glib-2.60.5/glib/gmain.c:3189
I have looked at the code and can not find any places where the bytes_written is larger than messages_bytes so my assumption is that the crashes are caused by overflow of messages_bytes.
I have not managed to re-create the crash but it will take some time before the overflow is reached.
A patch suggestion is attached which includes a unit test which triggers the problem where messages_bytes is not decreased when the write operation is only partly successful.0001-gstrtspconnection-messages_bytes-not-decreased.patch