gstrtspsrc command thread may get stuck in gst_rtspsrc_loop
When a new command is received and the command thread is in gst_rtspsrc_loop, the other thread will interrupt the command thread by calling gst_rtspsrc_connection_flush. This only works, however, if the command thread is currently busy receiving. If it is not, the thread will keep looping and never leave gst_rtspsrc_loop.
The issue was found when performing teardown and a pause command was sent followed by a stop command. When the test passes, the pause command gets interrupted before it has finished. When the test fails (rarely), the pause command finishes before the stop command begins, which results in the command thread getting stuck in gst_rtspsrc_loop.