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

Showing the changes to libavformat (3 of 3 files). Show all

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
141 ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf, AVIO_FLAG_READ_WRITE,141 ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf, AVIO_FLAG_READ_WRITE,
142 &parent->interrupt_callback, options,142 &parent->interrupt_callback, options,
143 parent->protocol_whitelist, parent->protocol_blacklist, parent);143 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 }
153 return ret;144 return ret;
154}145}
155 146
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
975 975
976static int tls_get_file_handle(URLContext *h)976static int tls_get_file_handle(URLContext *h)
977{977{
978 TLSContext *c = h->priv_data;978 TLSContext *p = h->priv_data;
979 return ffurl_get_file_handle(c->tls_shared.tcp);979 TLSShared *c = &p->tls_shared;
980 return ffurl_get_file_handle(c->is_dtls ? c->udp : c->tcp);
980}981}
981 982
982static int tls_get_short_seek(URLContext *h)983static int tls_get_short_seek(URLContext *h)
983{984{
984 TLSContext *s = h->priv_data;985 TLSContext *p = h->priv_data;
985 return ffurl_get_short_seek(s->tls_shared.tcp);986 TLSShared *c = &p->tls_shared;
987 return ffurl_get_short_seek(c->is_dtls ? c->udp : c->tcp);
986}988}
987 989
988static const AVOption options[] = {990static const AVOption options[] = {
@@ -1024,6 +1026,8 @@ const URLProtocol ff_dtls_protocol = { · 35 unmodified lines
1024 .url_close = dtls_close,1026 .url_close = dtls_close,
1025 .url_read = tls_read,1027 .url_read = tls_read,
1026 .url_write = tls_write,1028 .url_write = tls_write,
1029 .url_get_file_handle = tls_get_file_handle,
1030 .url_get_short_seek = tls_get_short_seek,
1027 .priv_data_size = sizeof(TLSContext),1031 .priv_data_size = sizeof(TLSContext),
1028 .flags = URL_PROTOCOL_FLAG_NETWORK,1032 .flags = URL_PROTOCOL_FLAG_NETWORK,
1029 .priv_data_class = &dtls_class,1033 .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
388 WHIPContext *whip = s->priv_data;388 WHIPContext *whip = s->priv_data;
389 /* reuse the udp created by whip */389 /* reuse the udp created by whip */
390 ff_dtls_set_udp(whip->dtls_uc, whip->udp);390 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
391 return 0;396 return 0;
392}397}
393 398

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