--- FFmpeg_orig/libavformat/rtsp.c    2020-08-13 15:44:07.631849461 +0200
+++ FFmpeg/libavformat/rtsp.c    2020-08-13 15:41:51.051617666 +0200
@@ -93,6 +93,7 @@
     RTSP_FLAG_OPTS("rtsp_flags", "set RTSP flags"),
     { "listen", "wait for incoming connections", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_LISTEN}, 0, 0, DEC, "rtsp_flags" },
     { "prefer_tcp", "try RTP via TCP first, if available", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_PREFER_TCP}, 0, 0, DEC|ENC, "rtsp_flags" },
+    { "force_tcp", "if RTP/AVP is received, force TCP instead of UDP", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_FORCE_TCP}, 0, 0, DEC|ENC, "rtsp_flags" },
     RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept from the server"),
     { "min_port", "set minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC },
     { "max_port", "set maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC },
@@ -896,6 +897,7 @@
     RTSPTransportField *th;
     char buf[256];
 
+    RTSPState *rt = s->priv_data;
     reply->nb_transports = 0;
 
     for (;;) {
@@ -932,7 +934,9 @@
             }
             th->transport = RTSP_TRANSPORT_RAW;
         }
-        if (!av_strcasecmp(lower_transport, "TCP"))
+        if (rt->rtsp_flags & RTSP_FLAG_FORCE_TCP)
+            th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
+        else if (!av_strcasecmp(lower_transport, "TCP"))
             th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
         else
             th->lower_transport = RTSP_LOWER_TRANSPORT_UDP;
@@ -1914,7 +1918,7 @@
                                   ~(lower_transport_mask - 1)];
 
         if ((lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP))
-                && (rt->rtsp_flags & RTSP_FLAG_PREFER_TCP))
+                && ((rt->rtsp_flags & RTSP_FLAG_PREFER_TCP) || (rt->rtsp_flags & RTSP_FLAG_FORCE_TCP)))
             lower_transport = RTSP_LOWER_TRANSPORT_TCP;
 
         err = ff_rtsp_make_setup_request(s, host, port, lower_transport,
--- FFmpeg_orig/libavformat/rtsp.h    2020-08-13 15:44:07.631849461 +0200
+++ FFmpeg/libavformat/rtsp.h    2020-08-13 14:22:21.825409774 +0200
@@ -421,6 +421,8 @@
 #define RTSP_FLAG_RTCP_TO_SOURCE 0x8 /**< Send RTCP packets to the source
                                           address of received packets. */
 #define RTSP_FLAG_PREFER_TCP  0x10   /**< Try RTP via TCP first if possible. */
+#define RTSP_FLAG_FORCE_TCP   0x20   /**< If RTP/AVP is received, force TCP
+                                          instead of trying UDP. */
 
 typedef struct RTSPSource {
     char addr[128]; /**< Source-specific multicast include source IP address (from SDP content) */