Unified · Split
| @@ -81,7 +81,7 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV · 80 unmodified lines | ||
| 81 | 81 | if (ret < 0) |
| 82 | 82 | return ret; |
| 83 | 83 | |
| 84 | − if (c->listen) | |
| 84 | + if (c->listen && !c->is_dtls) | |
| 85 | 85 | snprintf(opts, sizeof(opts), "?listen=1"); |
| 86 | 86 | |
| 87 | 87 | av_url_split(NULL, 0, NULL, 0, c->underlying_host, sizeof(c->underlying_host), &port, NULL, 0, uri); |
| @@ -95,7 +95,7 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV · 7 unmodified lines | ||
| 95 | 95 | c->listen = 1; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | − ff_url_join(buf, sizeof(buf), c->is_dtls ? "udp" : "tcp", NULL, c->underlying_host, port, "%s", p); | |
| 98 | + ff_url_join(buf, sizeof(buf), c->is_dtls ? "udp" : "tcp", NULL, (c->is_dtls && c->listen) ? "" : c->underlying_host, port, "%s", p); | |
| 99 | 99 | |
| 100 | 100 | hints.ai_flags = AI_NUMERICHOST; |
| 101 | 101 | if (!getaddrinfo(c->underlying_host, NULL, &hints, &ai)) { |
| @@ -127,7 +127,13 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV · 25 unmodified lines | ||
| 127 | 127 | |
| 128 | 128 | freeenv_utf8(env_http_proxy); |
| 129 | 129 | if (c->is_dtls) { |
| 130 | − av_dict_set_int(options, "connect", 1, 0); | |
| 130 | + if (c->listen) { | |
| 131 | + av_dict_set_int(options, "localport", port, 0); | |
| 132 | + av_dict_set(options, "localaddr", c->underlying_host, 0); | |
| 133 | + } else { | |
| 134 | + av_dict_set_int(options, "localport", 0, 0); | |
| 135 | + av_dict_set_int(options, "connect", 1, 0); | |
| 136 | + } | |
| 131 | 137 | av_dict_set_int(options, "fifo_size", 0, 0); |
| 132 | 138 | /* Set the max packet size to the buffer size. */ |
| 133 | 139 | av_dict_set_int(options, "pkt_size", c->mtu, 0); |