You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-10-06 05:47:18 +02:00
avformat/tls_openssl: initialize underlying protocol early for dtls_start()
The same way we do with TLS, so all tls URL options will be properly supported. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@@ -2052,12 +2052,19 @@ Datagram Transport Layer Security (DTLS)
|
|||||||
|
|
||||||
The required syntax for a DTLS URL is:
|
The required syntax for a DTLS URL is:
|
||||||
@example
|
@example
|
||||||
dtls://@var{hostname}:@var{port}
|
dtls://@var{hostname}:@var{port}[?@var{options}]
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@var{options} contains a list of &-separated options of the form
|
||||||
|
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||||
|
space) can be used to escape keys and values.
|
||||||
|
|
||||||
|
Options can also can be specified via command line options (or in code via
|
||||||
|
@code{AVOption}s).
|
||||||
|
|
||||||
DTLS shares most options with TLS, but operates over UDP instead of TCP.
|
DTLS shares most options with TLS, but operates over UDP instead of TCP.
|
||||||
The following parameters can be set via command line options
|
|
||||||
(or in code via @code{AVOption}s):
|
The list of supported options follows.
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
|
|
||||||
|
@@ -747,6 +747,13 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
s->is_dtls = 1;
|
s->is_dtls = 1;
|
||||||
|
|
||||||
|
if (!c->tls_shared.external_sock) {
|
||||||
|
if ((ret = ff_tls_open_underlying(&c->tls_shared, h, url, options)) < 0) {
|
||||||
|
av_log(c, AV_LOG_ERROR, "Failed to connect %s\n", url);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c->ctx = SSL_CTX_new(s->listen ? DTLS_server_method() : DTLS_client_method());
|
c->ctx = SSL_CTX_new(s->listen ? DTLS_server_method() : DTLS_client_method());
|
||||||
if (!c->ctx) {
|
if (!c->ctx) {
|
||||||
ret = AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
@@ -799,13 +806,6 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
|
|||||||
DTLS_set_link_mtu(c->ssl, s->mtu);
|
DTLS_set_link_mtu(c->ssl, s->mtu);
|
||||||
init_bio_method(h);
|
init_bio_method(h);
|
||||||
|
|
||||||
if (!c->tls_shared.external_sock) {
|
|
||||||
if ((ret = ff_tls_open_underlying(&c->tls_shared, h, url, options)) < 0) {
|
|
||||||
av_log(c, AV_LOG_ERROR, "Failed to connect %s\n", url);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This seems to be necessary despite explicitly setting client/server method above. */
|
/* This seems to be necessary despite explicitly setting client/server method above. */
|
||||||
if (s->listen)
|
if (s->listen)
|
||||||
SSL_set_accept_state(c->ssl);
|
SSL_set_accept_state(c->ssl);
|
||||||
@@ -836,6 +836,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
fail:
|
fail:
|
||||||
|
tls_close(h);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user