History

avformat/tls: fix udp init

Timo Rothenpieler committed 1 year ago

Commit 2e729241 parent 23c70e31 file · +9 −3Browse files

Unified · Split

libavformat/tls.c+9−3
@@ -81,7 +81,7 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV · 80 unmodified lines
81 if (ret < 0)81 if (ret < 0)
82 return ret;82 return ret;
83 83
84 if (c->listen)84 if (c->listen && !c->is_dtls)
85 snprintf(opts, sizeof(opts), "?listen=1");85 snprintf(opts, sizeof(opts), "?listen=1");
86 86
87 av_url_split(NULL, 0, NULL, 0, c->underlying_host, sizeof(c->underlying_host), &port, NULL, 0, uri);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 c->listen = 1;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 hints.ai_flags = AI_NUMERICHOST;100 hints.ai_flags = AI_NUMERICHOST;
101 if (!getaddrinfo(c->underlying_host, NULL, &hints, &ai)) {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 freeenv_utf8(env_http_proxy);128 freeenv_utf8(env_http_proxy);
129 if (c->is_dtls) {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 av_dict_set_int(options, "fifo_size", 0, 0);137 av_dict_set_int(options, "fifo_size", 0, 0);
132 /* Set the max packet size to the buffer size. */138 /* Set the max packet size to the buffer size. */
133 av_dict_set_int(options, "pkt_size", c->mtu, 0);139 av_dict_set_int(options, "pkt_size", c->mtu, 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t