History

avformat/tls: move whip specific init out of generic tls code

Timo Rothenpieler committed 1 year ago

Commit 2c7e1171 parent 7c91ae93 files · +13 −13Browse files

Unified · Split

3 files
  1. libavformat/tls.c +0 −9
  2. libavformat/tls_openssl.c +8 −4
  3. libavformat/whip.c +5 −0
libavformat/tls.c+0−9
@@ -141,15 +141,6 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV · 140 unmodified lines
141141 ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf, AVIO_FLAG_READ_WRITE,
142142 &parent->interrupt_callback, options,
143143 parent->protocol_whitelist, parent->protocol_blacklist, parent);
144− if (c->is_dtls) {
145− if (ret < 0) {
146− av_log(c, AV_LOG_ERROR, "Failed to open udp://%s:%d\n", c->underlying_host, port);
147− return ret;
148− }
149− /* Make the socket non-blocking, set to READ and WRITE mode after connected */
150− ff_socket_nonblock(ffurl_get_file_handle(c->udp), 1);
151− c->udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_NONBLOCK;
152− }
153144 return ret;
154145 }
155146
libavformat/tls_openssl.c+8−4
@@ -975,14 +975,16 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) · 974 unmodified lines
975975
976976 static int tls_get_file_handle(URLContext *h)
977977 {
978− TLSContext *c = h->priv_data;
979− return ffurl_get_file_handle(c->tls_shared.tcp);
978+ TLSContext *p = h->priv_data;
979+ TLSShared *c = &p->tls_shared;
980+ return ffurl_get_file_handle(c->is_dtls ? c->udp : c->tcp);
980981 }
981982
982983 static int tls_get_short_seek(URLContext *h)
983984 {
984− TLSContext *s = h->priv_data;
985− return ffurl_get_short_seek(s->tls_shared.tcp);
985+ TLSContext *p = h->priv_data;
986+ TLSShared *c = &p->tls_shared;
987+ return ffurl_get_short_seek(c->is_dtls ? c->udp : c->tcp);
986988 }
987989
988990 static const AVOption options[] = {
@@ -1024,6 +1026,8 @@ const URLProtocol ff_dtls_protocol = { · 35 unmodified lines
10241026 .url_close = dtls_close,
10251027 .url_read = tls_read,
10261028 .url_write = tls_write,
1029+ .url_get_file_handle = tls_get_file_handle,
1030+ .url_get_short_seek = tls_get_short_seek,
10271031 .priv_data_size = sizeof(TLSContext),
10281032 .flags = URL_PROTOCOL_FLAG_NETWORK,
10291033 .priv_data_class = &dtls_class,
libavformat/whip.c+5−0
@@ -388,6 +388,11 @@ static av_cold int dtls_initialize(AVFormatContext *s) · 387 unmodified lines
388388 WHIPContext *whip = s->priv_data;
389389 /* reuse the udp created by whip */
390390 ff_dtls_set_udp(whip->dtls_uc, whip->udp);
391+
392+ /* Make the socket non-blocking */
393+ ff_socket_nonblock(ffurl_get_file_handle(whip->dtls_uc), 1);
394+ whip->dtls_uc->flags |= AVIO_FLAG_NONBLOCK;
395+
391396 return 0;
392397 }
393398

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