From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 9A7AA4E04F for ; Sun, 6 Jul 2025 18:37:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 381A46911CC; Sun, 6 Jul 2025 21:36:57 +0300 (EEST) Received: from btbn.de (btbn.de [144.76.60.213]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 9BFE16911CC for ; Sun, 6 Jul 2025 21:36:48 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 39DAA27FFCD11; Sun, 06 Jul 2025 20:36:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1751827006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+JaQ55eV2z4ot8wZFXez79c3XPV5Zp2NCh44CeCrlkg=; b=VhOfUpExOtqH3kjM+DIeXysIYccU7jYqBxkABhCbKgpt6IQdeBvbYgjCjIr2rEFzl0ZStT YaEEASAPx4kkhD7MPTPcPVfie6K0wWOYoUGIdaL6X3OJMjHWvvXS09XnNi7IVLbMtwXp9Z RjqFy9gNg6NZKaE42hhmZBXc8g+rRSzOLncZmc5yeV4ICPcqquMBBnOj+FUuRX+0bGEQsQ 2oFkBTMUuExMWIXyCRQ/SBES41ReUyBsl/50c7fQTxM8ARRA9ik21LTiwUxj9ZzISYafph dRy4rXyKVYZmJ1ut9VODpKxKXqEzrNujn0D8wnR2i7vq7Le5cmq3FhN80Wt4WA== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sun, 6 Jul 2025 20:36:22 +0200 Message-ID: <20250706183634.38579-2-timo@rothenpieler.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250706183634.38579-1-timo@rothenpieler.org> References: <20250706183634.38579-1-timo@rothenpieler.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/8] avformat/tls: move whip specific init out of generic tls code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Timo Rothenpieler Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- libavformat/tls.c | 9 --------- libavformat/tls_openssl.c | 12 ++++++++---- libavformat/whip.c | 5 +++++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavformat/tls.c b/libavformat/tls.c index c0adaf61ce..bd9c05e6dc 100644 --- a/libavformat/tls.c +++ b/libavformat/tls.c @@ -141,15 +141,6 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf, AVIO_FLAG_READ_WRITE, &parent->interrupt_callback, options, parent->protocol_whitelist, parent->protocol_blacklist, parent); - if (c->is_dtls) { - if (ret < 0) { - av_log(c, AV_LOG_ERROR, "Failed to open udp://%s:%d\n", c->underlying_host, port); - return ret; - } - /* Make the socket non-blocking, set to READ and WRITE mode after connected */ - ff_socket_nonblock(ffurl_get_file_handle(c->udp), 1); - c->udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_NONBLOCK; - } return ret; } diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 08527418b0..0c76f110e3 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -1128,14 +1128,16 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) static int tls_get_file_handle(URLContext *h) { - TLSContext *c = h->priv_data; - return ffurl_get_file_handle(c->tls_shared.tcp); + TLSContext *p = h->priv_data; + TLSShared *c = &p->tls_shared; + return ffurl_get_file_handle(c->is_dtls ? c->udp : c->tcp); } static int tls_get_short_seek(URLContext *h) { - TLSContext *s = h->priv_data; - return ffurl_get_short_seek(s->tls_shared.tcp); + TLSContext *p = h->priv_data; + TLSShared *c = &p->tls_shared; + return ffurl_get_short_seek(c->is_dtls ? c->udp : c->tcp); } static const AVOption options[] = { @@ -1177,6 +1179,8 @@ const URLProtocol ff_dtls_protocol = { .url_close = dtls_close, .url_read = tls_read, .url_write = tls_write, + .url_get_file_handle = tls_get_file_handle, + .url_get_short_seek = tls_get_short_seek, .priv_data_size = sizeof(TLSContext), .flags = URL_PROTOCOL_FLAG_NETWORK, .priv_data_class = &dtls_class, diff --git a/libavformat/whip.c b/libavformat/whip.c index 84d4c5a1f3..4ac76e79f2 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -388,6 +388,11 @@ static av_cold int dtls_initialize(AVFormatContext *s) WHIPContext *whip = s->priv_data; /* reuse the udp created by whip */ ff_dtls_set_udp(whip->dtls_uc, whip->udp); + + /* Make the socket non-blocking */ + ff_socket_nonblock(ffurl_get_file_handle(whip->dtls_uc), 1); + whip->dtls_uc->flags |= AVIO_FLAG_NONBLOCK; + return 0; } -- 2.49.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".