Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
@ 2025-06-28 15:01 Jack Lau via ffmpeg-devel
  2025-06-28 22:49 ` Timo Rothenpieler
  0 siblings, 1 reply; 8+ messages in thread
From: Jack Lau via ffmpeg-devel @ 2025-06-28 15:01 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Jack Lau

[-- Attachment #1: Type: message/rfc822, Size: 35015 bytes --]

From: Jack Lau <jacklau1222@qq.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Jack Lau <jacklau1222@qq.com>
Subject: [PATCH v5 3/3] avformat/whip: fix typos
Date: Sat, 28 Jun 2025 23:01:03 +0800
Message-ID: <tencent_892C0A9FEA582C549556DE0BF849DFC8D406@qq.com>

Remove redundant "WHIP: " prefix in log context
since it already add whip context.

Fix grammers in whip options descriptions

Signed-off-by: Jack Lau <jacklau1222@qq.com>
---
 libavformat/tls.c  |   2 +-
 libavformat/whip.c | 152 ++++++++++++++++++++++-----------------------
 2 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index da53835200..7f9b940387 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -137,7 +137,7 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV
                                parent->protocol_whitelist, parent->protocol_blacklist, parent);
     if (c->is_dtls) {
         if (ret < 0) {
-            av_log(c, AV_LOG_ERROR, "WHIP: Failed to connect udp://%s:%d\n", c->underlying_host, port);
+            av_log(c, AV_LOG_ERROR, "Failed to connect udp://%s:%d\n", c->underlying_host, port);
             return ret;
         }
         /* Make the socket non-blocking, set to READ and WRITE mode after connected */
diff --git a/libavformat/whip.c b/libavformat/whip.c
index 8d1be90f32..8b011b8b1c 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -364,14 +364,14 @@ static int dtls_context_on_state(AVFormatContext *s, const char* type, const cha
 
     if (state == DTLS_STATE_CLOSED) {
         whip->dtls_closed = 1;
-        av_log(whip, AV_LOG_VERBOSE, "WHIP: DTLS session closed, type=%s, desc=%s, elapsed=%dms\n",
+        av_log(whip, AV_LOG_VERBOSE, "DTLS session closed, type=%s, desc=%s, elapsed=%dms\n",
             type ? type : "", desc ? desc : "", ELAPSED(whip->whip_starttime, av_gettime()));
         goto error;
     }
 
     if (state == DTLS_STATE_FAILED) {
         whip->state = WHIP_STATE_FAILED;
-        av_log(whip, AV_LOG_ERROR, "WHIP: DTLS session failed, type=%s, desc=%s\n",
+        av_log(whip, AV_LOG_ERROR, "DTLS session failed, type=%s, desc=%s\n",
             type ? type : "", desc ? desc : "");
         whip->dtls_ret = AVERROR(EIO);
         goto error;
@@ -380,7 +380,7 @@ static int dtls_context_on_state(AVFormatContext *s, const char* type, const cha
     if (state == DTLS_STATE_FINISHED && whip->state < WHIP_STATE_DTLS_FINISHED) {
         whip->state = WHIP_STATE_DTLS_FINISHED;
         whip->whip_dtls_time = av_gettime();
-        av_log(whip, AV_LOG_VERBOSE, "WHIP: DTLS handshake is done, elapsed=%dms\n",
+        av_log(whip, AV_LOG_VERBOSE, "DTLS handshake is done, elapsed=%dms\n",
             ELAPSED(whip->whip_starttime, av_gettime()));
         return ret;
     }
@@ -409,7 +409,7 @@ static av_cold int initialize(AVFormatContext *s)
 
     ret = certificate_key_init(s);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to init certificate and key\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to init certificate and key\n");
         return ret;
     }
 
@@ -418,13 +418,13 @@ static av_cold int initialize(AVFormatContext *s)
     av_lfg_init(&whip->rnd, seed);
 
     if (whip->pkt_size < ideal_pkt_size)
-        av_log(whip, AV_LOG_WARNING, "WHIP: pkt_size=%d(<%d) is too small, may cause packet loss\n",
+        av_log(whip, AV_LOG_WARNING, "pkt_size=%d(<%d) is too small, may cause packet loss\n",
                whip->pkt_size, ideal_pkt_size);
 
     if (whip->state < WHIP_STATE_INIT)
         whip->state = WHIP_STATE_INIT;
     whip->whip_init_time = av_gettime();
-    av_log(whip, AV_LOG_VERBOSE, "WHIP: Init state=%d, handshake_timeout=%dms, pkt_size=%d, seed=%d, elapsed=%dms\n",
+    av_log(whip, AV_LOG_VERBOSE, "Init state=%d, handshake_timeout=%dms, pkt_size=%d, seed=%d, elapsed=%dms\n",
         whip->state, whip->handshake_timeout, whip->pkt_size, seed, ELAPSED(whip->whip_starttime, av_gettime()));
 
     return 0;
@@ -457,7 +457,7 @@ static int parse_profile_level(AVFormatContext *s, AVCodecParameters *par)
         return ret;
 
     if (!par->extradata || par->extradata_size <= 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Unable to parse profile from empty extradata=%p, size=%d\n",
+        av_log(whip, AV_LOG_ERROR, "Unable to parse profile from empty extradata=%p, size=%d\n",
             par->extradata, par->extradata_size);
         return AVERROR(EINVAL);
     }
@@ -471,12 +471,12 @@ static int parse_profile_level(AVFormatContext *s, AVCodecParameters *par)
         if ((state & 0x1f) == H264_NAL_SPS) {
             ret = ff_avc_decode_sps(sps, r, r1 - r);
             if (ret < 0) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Failed to decode SPS, state=%x, size=%d\n",
+                av_log(whip, AV_LOG_ERROR, "Failed to decode SPS, state=%x, size=%d\n",
                     state, (int)(r1 - r));
                 return ret;
             }
 
-            av_log(whip, AV_LOG_VERBOSE, "WHIP: Parse profile=%d, level=%d from SPS\n",
+            av_log(whip, AV_LOG_VERBOSE, "Parse profile=%d, level=%d from SPS\n",
                 sps->profile_idc, sps->level_idc);
             par->profile = sps->profile_idc;
             par->level = sps->level_idc;
@@ -520,62 +520,62 @@ static int parse_codec(AVFormatContext *s)
         switch (par->codec_type) {
         case AVMEDIA_TYPE_VIDEO:
             if (whip->video_par) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Only one video stream is supported by RTC\n");
+                av_log(whip, AV_LOG_ERROR, "Only one video stream is supported by RTC\n");
                 return AVERROR(EINVAL);
             }
             whip->video_par = par;
 
             if (par->codec_id != AV_CODEC_ID_H264) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Unsupported video codec %s by RTC, choose h264\n",
+                av_log(whip, AV_LOG_ERROR, "Unsupported video codec %s by RTC, choose h264\n",
                        desc ? desc->name : "unknown");
                 return AVERROR_PATCHWELCOME;
             }
 
             if (par->video_delay > 0) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Unsupported B frames by RTC\n");
+                av_log(whip, AV_LOG_ERROR, "Unsupported B frames by RTC\n");
                 return AVERROR_PATCHWELCOME;
             }
 
             if ((ret = parse_profile_level(s, par)) < 0) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Failed to parse SPS/PPS from extradata\n");
+                av_log(whip, AV_LOG_ERROR, "Failed to parse SPS/PPS from extradata\n");
                 return AVERROR(EINVAL);
             }
 
             if (par->profile == AV_PROFILE_UNKNOWN) {
-                av_log(whip, AV_LOG_WARNING, "WHIP: No profile found in extradata, consider baseline\n");
+                av_log(whip, AV_LOG_WARNING, "No profile found in extradata, consider baseline\n");
                 return AVERROR(EINVAL);
             }
             if (par->level == AV_LEVEL_UNKNOWN) {
-                av_log(whip, AV_LOG_WARNING, "WHIP: No level found in extradata, consider 3.1\n");
+                av_log(whip, AV_LOG_WARNING, "No level found in extradata, consider 3.1\n");
                 return AVERROR(EINVAL);
             }
             break;
         case AVMEDIA_TYPE_AUDIO:
             if (whip->audio_par) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Only one audio stream is supported by RTC\n");
+                av_log(whip, AV_LOG_ERROR, "Only one audio stream is supported by RTC\n");
                 return AVERROR(EINVAL);
             }
             whip->audio_par = par;
 
             if (par->codec_id != AV_CODEC_ID_OPUS) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Unsupported audio codec %s by RTC, choose opus\n",
+                av_log(whip, AV_LOG_ERROR, "Unsupported audio codec %s by RTC, choose opus\n",
                     desc ? desc->name : "unknown");
                 return AVERROR_PATCHWELCOME;
             }
 
             if (par->ch_layout.nb_channels != 2) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Unsupported audio channels %d by RTC, choose stereo\n",
+                av_log(whip, AV_LOG_ERROR, "Unsupported audio channels %d by RTC, choose stereo\n",
                     par->ch_layout.nb_channels);
                 return AVERROR_PATCHWELCOME;
             }
 
             if (par->sample_rate != 48000) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Unsupported audio sample rate %d by RTC, choose 48000\n", par->sample_rate);
+                av_log(whip, AV_LOG_ERROR, "Unsupported audio sample rate %d by RTC, choose 48000\n", par->sample_rate);
                 return AVERROR_PATCHWELCOME;
             }
             break;
         default:
-            av_log(whip, AV_LOG_ERROR, "WHIP: Codec type '%s' for stream %d is not supported by RTC\n",
+            av_log(whip, AV_LOG_ERROR, "Codec type '%s' for stream %d is not supported by RTC\n",
                    av_get_media_type_string(par->codec_type), i);
             return AVERROR_PATCHWELCOME;
         }
@@ -603,7 +603,7 @@ static int generate_sdp_offer(AVFormatContext *s)
     av_bprint_init(&bp, 1, MAX_SDP_SIZE);
 
     if (whip->sdp_offer) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: SDP offer is already set\n");
+        av_log(whip, AV_LOG_ERROR, "SDP offer is already set\n");
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -701,7 +701,7 @@ static int generate_sdp_offer(AVFormatContext *s)
     }
 
     if (!av_bprint_is_complete(&bp)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Offer exceed max %d, %s\n", MAX_SDP_SIZE, bp.str);
+        av_log(whip, AV_LOG_ERROR, "Offer exceed max %d, %s\n", MAX_SDP_SIZE, bp.str);
         ret = AVERROR(EIO);
         goto end;
     }
@@ -715,7 +715,7 @@ static int generate_sdp_offer(AVFormatContext *s)
     if (whip->state < WHIP_STATE_OFFER)
         whip->state = WHIP_STATE_OFFER;
     whip->whip_offer_time = av_gettime();
-    av_log(whip, AV_LOG_VERBOSE, "WHIP: Generated state=%d, offer: %s\n", whip->state, whip->sdp_offer);
+    av_log(whip, AV_LOG_VERBOSE, "Generated state=%d, offer: %s\n", whip->state, whip->sdp_offer);
 
 end:
     av_bprint_finalize(&bp, NULL);
@@ -750,7 +750,7 @@ static int exchange_sdp(AVFormatContext *s)
     }
 
     if (!whip->sdp_offer || !strlen(whip->sdp_offer)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: No offer to exchange\n");
+        av_log(whip, AV_LOG_ERROR, "No offer to exchange\n");
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -759,7 +759,7 @@ static int exchange_sdp(AVFormatContext *s)
     if (whip->authorization)
         ret += snprintf(buf + ret, sizeof(buf) - ret, "Authorization: Bearer %s\r\n", whip->authorization);
     if (ret <= 0 || ret >= sizeof(buf)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to generate headers, size=%d, %s\n", ret, buf);
+        av_log(whip, AV_LOG_ERROR, "Failed to generate headers, size=%d, %s\n", ret, buf);
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -778,7 +778,7 @@ static int exchange_sdp(AVFormatContext *s)
     ret = ffurl_open_whitelist(&whip_uc, s->url, AVIO_FLAG_READ_WRITE, &s->interrupt_callback,
         &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to request url=%s, offer: %s\n", s->url, whip->sdp_offer);
+        av_log(whip, AV_LOG_ERROR, "Failed to request url=%s, offer: %s\n", s->url, whip->sdp_offer);
         goto end;
     }
 
@@ -798,21 +798,21 @@ static int exchange_sdp(AVFormatContext *s)
             break;
         }
         if (ret <= 0) {
-            av_log(whip, AV_LOG_ERROR, "WHIP: Failed to read response from url=%s, offer is %s, answer is %s\n",
+            av_log(whip, AV_LOG_ERROR, "Failed to read response from url=%s, offer is %s, answer is %s\n",
                 s->url, whip->sdp_offer, whip->sdp_answer);
             goto end;
         }
 
         av_bprintf(&bp, "%.*s", ret, buf);
         if (!av_bprint_is_complete(&bp)) {
-            av_log(whip, AV_LOG_ERROR, "WHIP: Answer exceed max size %d, %.*s, %s\n", MAX_SDP_SIZE, ret, buf, bp.str);
+            av_log(whip, AV_LOG_ERROR, "Answer exceed max size %d, %.*s, %s\n", MAX_SDP_SIZE, ret, buf, bp.str);
             ret = AVERROR(EIO);
             goto end;
         }
     }
 
     if (!av_strstart(bp.str, "v=", NULL)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Invalid answer: %s\n", bp.str);
+        av_log(whip, AV_LOG_ERROR, "Invalid answer: %s\n", bp.str);
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -825,7 +825,7 @@ static int exchange_sdp(AVFormatContext *s)
 
     if (whip->state < WHIP_STATE_ANSWER)
         whip->state = WHIP_STATE_ANSWER;
-    av_log(whip, AV_LOG_VERBOSE, "WHIP: Got state=%d, answer: %s\n", whip->state, whip->sdp_answer);
+    av_log(whip, AV_LOG_VERBOSE, "Got state=%d, answer: %s\n", whip->state, whip->sdp_answer);
 
 end:
     ffurl_closep(&whip_uc);
@@ -856,7 +856,7 @@ static int parse_answer(AVFormatContext *s)
     WHIPContext *whip = s->priv_data;
 
     if (!whip->sdp_answer || !strlen(whip->sdp_answer)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: No answer to parse\n");
+        av_log(whip, AV_LOG_ERROR, "No answer to parse\n");
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -887,7 +887,7 @@ static int parse_answer(AVFormatContext *s)
                 struct in6_addr addr6;
                 ret = sscanf(ptr, "%16s %d %128s %d typ host", protocol, &priority, host, &port);
                 if (ret != 4) {
-                    av_log(whip, AV_LOG_ERROR, "WHIP: Failed %d to parse line %d %s from %s\n",
+                    av_log(whip, AV_LOG_ERROR, "Failed %d to parse line %d %s from %s\n",
                         ret, i, line, whip->sdp_answer);
                     ret = AVERROR(EIO);
                     goto end;
@@ -899,7 +899,7 @@ static int parse_answer(AVFormatContext *s)
                 }
 
                 if (av_strcasecmp(protocol, "udp")) {
-                    av_log(whip, AV_LOG_ERROR, "WHIP: Protocol %s is not supported by RTC, choose udp, line %d %s of %s\n",
+                    av_log(whip, AV_LOG_ERROR, "Protocol %s is not supported by RTC, choose udp, line %d %s of %s\n",
                         protocol, i, line, whip->sdp_answer);
                     ret = AVERROR(EIO);
                     goto end;
@@ -917,19 +917,19 @@ static int parse_answer(AVFormatContext *s)
     }
 
     if (!whip->ice_pwd_remote || !strlen(whip->ice_pwd_remote)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: No remote ice pwd parsed from %s\n", whip->sdp_answer);
+        av_log(whip, AV_LOG_ERROR, "No remote ice pwd parsed from %s\n", whip->sdp_answer);
         ret = AVERROR(EINVAL);
         goto end;
     }
 
     if (!whip->ice_ufrag_remote || !strlen(whip->ice_ufrag_remote)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: No remote ice ufrag parsed from %s\n", whip->sdp_answer);
+        av_log(whip, AV_LOG_ERROR, "No remote ice ufrag parsed from %s\n", whip->sdp_answer);
         ret = AVERROR(EINVAL);
         goto end;
     }
 
     if (!whip->ice_protocol || !whip->ice_host || !whip->ice_port) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: No ice candidate parsed from %s\n", whip->sdp_answer);
+        av_log(whip, AV_LOG_ERROR, "No ice candidate parsed from %s\n", whip->sdp_answer);
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -937,7 +937,7 @@ static int parse_answer(AVFormatContext *s)
     if (whip->state < WHIP_STATE_NEGOTIATED)
         whip->state = WHIP_STATE_NEGOTIATED;
     whip->whip_answer_time = av_gettime();
-    av_log(whip, AV_LOG_VERBOSE, "WHIP: SDP state=%d, offer=%luB, answer=%luB, ufrag=%s, pwd=%luB, transport=%s://%s:%d, elapsed=%dms\n",
+    av_log(whip, AV_LOG_VERBOSE, "SDP state=%d, offer=%luB, answer=%luB, ufrag=%s, pwd=%luB, transport=%s://%s:%d, elapsed=%dms\n",
         whip->state, strlen(whip->sdp_offer), strlen(whip->sdp_answer), whip->ice_ufrag_remote, strlen(whip->ice_pwd_remote),
         whip->ice_protocol, whip->ice_host, whip->ice_port, ELAPSED(whip->whip_starttime, av_gettime()));
 
@@ -988,7 +988,7 @@ static int ice_create_request(AVFormatContext *s, uint8_t *buf, int buf_size, in
     /* The username is the concatenation of the two ICE ufrag */
     ret = snprintf(username, sizeof(username), "%s:%s", whip->ice_ufrag_remote, whip->ice_ufrag_local);
     if (ret <= 0 || ret >= sizeof(username)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to build username %s:%s, max=%lu, ret=%d\n",
+        av_log(whip, AV_LOG_ERROR, "Failed to build username %s:%s, max=%lu, ret=%d\n",
             whip->ice_ufrag_remote, whip->ice_ufrag_local, sizeof(username), ret);
         ret = AVERROR(EIO);
         goto end;
@@ -1057,7 +1057,7 @@ static int ice_create_response(AVFormatContext *s, char *tid, int tid_size, uint
     WHIPContext *whip = s->priv_data;
 
     if (tid_size != 12) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Invalid transaction ID size. Expected 12, got %d\n", tid_size);
+        av_log(whip, AV_LOG_ERROR, "Invalid transaction ID size. Expected 12, got %d\n", tid_size);
         return AVERROR(EINVAL);
     }
 
@@ -1160,7 +1160,7 @@ static int ice_handle_binding_request(AVFormatContext *s, char *buf, int buf_siz
         return ret;
 
     if (buf_size < ICE_STUN_HEADER_SIZE) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Invalid STUN message, expected at least %d, got %d\n",
+        av_log(whip, AV_LOG_ERROR, "Invalid STUN message, expected at least %d, got %d\n",
             ICE_STUN_HEADER_SIZE, buf_size);
         return AVERROR(EINVAL);
     }
@@ -1171,13 +1171,13 @@ static int ice_handle_binding_request(AVFormatContext *s, char *buf, int buf_siz
     /* Build the STUN binding response. */
     ret = ice_create_response(s, tid, sizeof(tid), whip->buf, sizeof(whip->buf), &size);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to create STUN binding response, size=%d\n", size);
+        av_log(whip, AV_LOG_ERROR, "Failed to create STUN binding response, size=%d\n", size);
         return ret;
     }
 
     ret = ffurl_write(whip->udp, whip->buf, size);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to send STUN binding response, size=%d\n", size);
+        av_log(whip, AV_LOG_ERROR, "Failed to send STUN binding response, size=%d\n", size);
         return ret;
     }
 
@@ -1207,7 +1207,7 @@ static int udp_connect(AVFormatContext *s)
     ret = ffurl_open_whitelist(&whip->udp, url, AVIO_FLAG_WRITE, &s->interrupt_callback,
         &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to connect udp://%s:%d\n", whip->ice_host, whip->ice_port);
+        av_log(whip, AV_LOG_ERROR, "Failed to connect udp://%s:%d\n", whip->ice_host, whip->ice_port);
         goto end;
     }
 
@@ -1218,7 +1218,7 @@ static int udp_connect(AVFormatContext *s)
     if (whip->state < WHIP_STATE_UDP_CONNECTED)
         whip->state = WHIP_STATE_UDP_CONNECTED;
     whip->whip_udp_time = av_gettime();
-    av_log(whip, AV_LOG_VERBOSE, "WHIP: UDP state=%d, elapsed=%dms, connected to udp://%s:%d\n",
+    av_log(whip, AV_LOG_VERBOSE, "UDP state=%d, elapsed=%dms, connected to udp://%s:%d\n",
         whip->state, ELAPSED(whip->whip_starttime, av_gettime()), whip->ice_host, whip->ice_port);
 
 end:
@@ -1236,7 +1236,7 @@ static int ice_dtls_handshake(AVFormatContext *s)
     char buf[256], *cert_buf = NULL, *key_buf = NULL;
 
     if (whip->state < WHIP_STATE_UDP_CONNECTED || !whip->udp) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: UDP not connected, state=%d, udp=%p\n", whip->state, whip->udp);
+        av_log(whip, AV_LOG_ERROR, "UDP not connected, state=%d, udp=%p\n", whip->state, whip->udp);
         return AVERROR(EINVAL);
     }
 
@@ -1245,13 +1245,13 @@ static int ice_dtls_handshake(AVFormatContext *s)
             /* Build the STUN binding request. */
             ret = ice_create_request(s, whip->buf, sizeof(whip->buf), &size);
             if (ret < 0) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Failed to create STUN binding request, size=%d\n", size);
+                av_log(whip, AV_LOG_ERROR, "Failed to create STUN binding request, size=%d\n", size);
                 goto end;
             }
 
             ret = ffurl_write(whip->udp, whip->buf, size);
             if (ret < 0) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Failed to send STUN binding request, size=%d\n", size);
+                av_log(whip, AV_LOG_ERROR, "Failed to send STUN binding request, size=%d\n", size);
                 goto end;
             }
 
@@ -1266,7 +1266,7 @@ next_packet:
 
         now = av_gettime();
         if (now - starttime >= whip->handshake_timeout * 1000) {
-            av_log(whip, AV_LOG_ERROR, "WHIP: DTLS handshake timeout=%dms, cost=%dms, elapsed=%dms, state=%d\n",
+            av_log(whip, AV_LOG_ERROR, "DTLS handshake timeout=%dms, cost=%dms, elapsed=%dms, state=%d\n",
                 whip->handshake_timeout, ELAPSED(starttime, now), ELAPSED(whip->whip_starttime, now), whip->state);
             ret = AVERROR(ETIMEDOUT);
             goto end;
@@ -1281,7 +1281,7 @@ next_packet:
                 av_usleep(5 * 1000);
                 continue;
             }
-            av_log(whip, AV_LOG_ERROR, "WHIP: Failed to read message\n");
+            av_log(whip, AV_LOG_ERROR, "Failed to read message\n");
             goto end;
         }
 
@@ -1294,7 +1294,7 @@ next_packet:
             if (whip->state < WHIP_STATE_ICE_CONNECTED) {
                 whip->state = WHIP_STATE_ICE_CONNECTED;
                 whip->whip_ice_time = av_gettime();
-                av_log(whip, AV_LOG_VERBOSE, "WHIP: ICE STUN ok, state=%d, url=udp://%s:%d, location=%s, username=%s:%s, res=%dB, elapsed=%dms\n",
+                av_log(whip, AV_LOG_VERBOSE, "ICE STUN ok, state=%d, url=udp://%s:%d, location=%s, username=%s:%s, res=%dB, elapsed=%dms\n",
                     whip->state, whip->ice_host, whip->ice_port, whip->whip_resource_url ? whip->whip_resource_url : "",
                     whip->ice_ufrag_remote, whip->ice_ufrag_local, ret, ELAPSED(whip->whip_starttime, av_gettime()));
 
@@ -1394,20 +1394,20 @@ static int setup_srtp(AVFormatContext *s)
 
     /* Setup SRTP context for outgoing packets */
     if (!av_base64_encode(buf, sizeof(buf), send_key, sizeof(send_key))) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to encode send key\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to encode send key\n");
         ret = AVERROR(EIO);
         goto end;
     }
 
     ret = ff_srtp_set_crypto(&whip->srtp_audio_send, suite, buf);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to set crypto for audio send\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to set crypto for audio send\n");
         goto end;
     }
 
     ret = ff_srtp_set_crypto(&whip->srtp_video_send, suite, buf);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to set crypto for video send\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to set crypto for video send\n");
         goto end;
     }
 
@@ -1419,21 +1419,21 @@ static int setup_srtp(AVFormatContext *s)
 
     /* Setup SRTP context for incoming packets */
     if (!av_base64_encode(buf, sizeof(buf), recv_key, sizeof(recv_key))) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to encode recv key\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to encode recv key\n");
         ret = AVERROR(EIO);
         goto end;
     }
 
     ret = ff_srtp_set_crypto(&whip->srtp_recv, suite, buf);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to set crypto for recv\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to set crypto for recv\n");
         goto end;
     }
 
     if (whip->state < WHIP_STATE_SRTP_FINISHED)
         whip->state = WHIP_STATE_SRTP_FINISHED;
     whip->whip_srtp_time = av_gettime();
-    av_log(whip, AV_LOG_VERBOSE, "WHIP: SRTP setup done, state=%d, suite=%s, key=%luB, elapsed=%dms\n",
+    av_log(whip, AV_LOG_VERBOSE, "SRTP setup done, state=%d, suite=%s, key=%luB, elapsed=%dms\n",
         whip->state, suite, sizeof(send_key), ELAPSED(whip->whip_starttime, av_gettime()));
 
 end:
@@ -1472,13 +1472,13 @@ static int on_rtp_write_packet(void *opaque, const uint8_t *buf, int buf_size)
     /* Encrypt by SRTP and send out. */
     cipher_size = ff_srtp_encrypt(srtp, buf, buf_size, whip->buf, sizeof(whip->buf));
     if (cipher_size <= 0 || cipher_size < buf_size) {
-        av_log(whip, AV_LOG_WARNING, "WHIP: Failed to encrypt packet=%dB, cipher=%dB\n", buf_size, cipher_size);
+        av_log(whip, AV_LOG_WARNING, "Failed to encrypt packet=%dB, cipher=%dB\n", buf_size, cipher_size);
         return 0;
     }
 
     ret = ffurl_write(whip->udp, whip->buf, cipher_size);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to write packet=%dB, ret=%d\n", cipher_size, ret);
+        av_log(whip, AV_LOG_ERROR, "Failed to write packet=%dB, ret=%d\n", cipher_size, ret);
         return ret;
     }
 
@@ -1507,7 +1507,7 @@ static int create_rtp_muxer(AVFormatContext *s)
 
     const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
     if (!rtp_format) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to guess rtp muxer\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to guess rtp muxer\n");
         ret = AVERROR(ENOSYS);
         goto end;
     }
@@ -1575,7 +1575,7 @@ static int create_rtp_muxer(AVFormatContext *s)
 
         ret = avformat_write_header(rtp_ctx, &opts);
         if (ret < 0) {
-            av_log(whip, AV_LOG_ERROR, "WHIP: Failed to write rtp header\n");
+            av_log(whip, AV_LOG_ERROR, "Failed to write rtp header\n");
             goto end;
         }
 
@@ -1587,7 +1587,7 @@ static int create_rtp_muxer(AVFormatContext *s)
 
     if (whip->state < WHIP_STATE_READY)
         whip->state = WHIP_STATE_READY;
-    av_log(whip, AV_LOG_INFO, "WHIP: Muxer state=%d, buffer_size=%d, max_packet_size=%d, "
+    av_log(whip, AV_LOG_INFO, "Muxer state=%d, buffer_size=%d, max_packet_size=%d, "
                            "elapsed=%dms(init:%d,offer:%d,answer:%d,udp:%d,ice:%d,dtls:%d,srtp:%d)\n",
         whip->state, buffer_size, max_packet_size, ELAPSED(whip->whip_starttime, av_gettime()),
         ELAPSED(whip->whip_starttime,   whip->whip_init_time),
@@ -1629,7 +1629,7 @@ static int dispose_session(AVFormatContext *s)
     if (whip->authorization)
         ret += snprintf(buf + ret, sizeof(buf) - ret, "Authorization: Bearer %s\r\n", whip->authorization);
     if (ret <= 0 || ret >= sizeof(buf)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to generate headers, size=%d, %s\n", ret, buf);
+        av_log(whip, AV_LOG_ERROR, "Failed to generate headers, size=%d, %s\n", ret, buf);
         ret = AVERROR(EINVAL);
         goto end;
     }
@@ -1640,7 +1640,7 @@ static int dispose_session(AVFormatContext *s)
     ret = ffurl_open_whitelist(&whip_uc, whip->whip_resource_url, AVIO_FLAG_READ_WRITE, &s->interrupt_callback,
         &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
     if (ret < 0) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to DELETE url=%s\n", whip->whip_resource_url);
+        av_log(whip, AV_LOG_ERROR, "Failed to DELETE url=%s\n", whip->whip_resource_url);
         goto end;
     }
 
@@ -1651,12 +1651,12 @@ static int dispose_session(AVFormatContext *s)
             break;
         }
         if (ret < 0) {
-            av_log(whip, AV_LOG_ERROR, "WHIP: Failed to read response from DELETE url=%s\n", whip->whip_resource_url);
+            av_log(whip, AV_LOG_ERROR, "Failed to read response from DELETE url=%s\n", whip->whip_resource_url);
             goto end;
         }
     }
 
-    av_log(whip, AV_LOG_INFO, "WHIP: Dispose resource %s ok\n", whip->whip_resource_url);
+    av_log(whip, AV_LOG_INFO, "Dispose resource %s ok\n", whip->whip_resource_url);
 
 end:
     ffurl_closep(&whip_uc);
@@ -1802,18 +1802,18 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret > 0) {
         if (is_dtls_packet(whip->buf, ret)) {
             if ((ret = ffurl_write(whip->dtls_uc, whip->buf, ret)) < 0) {
-                av_log(whip, AV_LOG_ERROR, "WHIP: Failed to handle DTLS message\n");
+                av_log(whip, AV_LOG_ERROR, "Failed to handle DTLS message\n");
                 goto end;
             }
         }
     } else if (ret != AVERROR(EAGAIN)) {
-        av_log(whip, AV_LOG_ERROR, "WHIP: Failed to read from UDP socket\n");
+        av_log(whip, AV_LOG_ERROR, "Failed to read from UDP socket\n");
         goto end;
     }
 
     if (whip->h264_annexb_insert_sps_pps && st->codecpar->codec_id == AV_CODEC_ID_H264) {
         if ((ret = h264_annexb_insert_sps_pps(s, pkt)) < 0) {
-            av_log(whip, AV_LOG_ERROR, "WHIP: Failed to insert SPS/PPS before IDR\n");
+            av_log(whip, AV_LOG_ERROR, "Failed to insert SPS/PPS before IDR\n");
             goto end;
         }
     }
@@ -1821,10 +1821,10 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
     ret = ff_write_chained(rtp_ctx, 0, pkt, s, 0);
     if (ret < 0) {
         if (ret == AVERROR(EINVAL)) {
-            av_log(whip, AV_LOG_WARNING, "WHIP: Ignore failed to write packet=%dB, ret=%d\n", pkt->size, ret);
+            av_log(whip, AV_LOG_WARNING, "Ignore failed to write packet=%dB, ret=%d\n", pkt->size, ret);
             ret = 0;
         } else
-            av_log(whip, AV_LOG_ERROR, "WHIP: Failed to write packet, size=%d\n", pkt->size);
+            av_log(whip, AV_LOG_ERROR, "Failed to write packet, size=%d\n", pkt->size);
         goto end;
     }
 
@@ -1845,7 +1845,7 @@ static av_cold void whip_deinit(AVFormatContext *s)
 
     ret = dispose_session(s);
     if (ret < 0)
-        av_log(whip, AV_LOG_WARNING, "WHIP: Failed to dispose resource, ret=%d\n", ret);
+        av_log(whip, AV_LOG_WARNING, "Failed to dispose resource, ret=%d\n", ret);
 
     for (i = 0; i < s->nb_streams; i++) {
         AVFormatContext* rtp_ctx = s->streams[i]->priv_data;
@@ -1892,7 +1892,7 @@ static int whip_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket
         extradata_isom = st->codecpar->extradata_size > 0 && st->codecpar->extradata[0] == 1;
         if (pkt->size >= 5 && AV_RB32(b) != 0x0000001 && (AV_RB24(b) != 0x000001 || extradata_isom)) {
             ret = ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
-            av_log(whip, AV_LOG_VERBOSE, "WHIP: Enable BSF h264_mp4toannexb, packet=[%x %x %x %x %x ...], extradata_isom=%d\n",
+            av_log(whip, AV_LOG_VERBOSE, "Enable BSF h264_mp4toannexb, packet=[%x %x %x %x %x ...], extradata_isom=%d\n",
                 b[0], b[1], b[2], b[3], b[4], extradata_isom);
         } else
             whip->h264_annexb_insert_sps_pps = 1;
@@ -1908,15 +1908,15 @@ static const AVOption options[] = {
         AV_OPT_TYPE_INT,    { .i64 = 5000 },                        -1, INT_MAX, ENC },
     { "pkt_size",           "The maximum size, in bytes, of RTP packets that send out", OFFSET(pkt_size),
         AV_OPT_TYPE_INT,    { .i64 = 1200 },                        -1, INT_MAX, ENC },
-    { "authorization",      "The optional Bearer token for WHIP Authorization",         OFFSET(authorization),
+    { "authorization",      "Optional bearer token for WHIP Authorization",             OFFSET(authorization),
         AV_OPT_TYPE_STRING, { .str = NULL },                        0,        0, ENC },
-    { "cert_file",          "The optional certificate file path for DTLS",              OFFSET(cert_file),
+    { "cert_file",          "Optional certificate file path for DTLS",                  OFFSET(cert_file),
         AV_OPT_TYPE_STRING, { .str = NULL },                        0,        0, ENC },
-    { "key_file",           "The optional private key file path for DTLS",              OFFSET(key_file),
+    { "key_file",           "Optional private key file path for DTLS",                  OFFSET(key_file),
         AV_OPT_TYPE_STRING, { .str = NULL },                        0,        0, ENC },
     { "whip_flags",         "Set flags affecting WHIP connection behavior",             OFFSET(flags),
         AV_OPT_TYPE_FLAGS,  { .i64 = 0 },                           0, UINT_MAX, ENC, .unit = "flags" },
-    { "ignore_ipv6",        "(Optional) Ignore any IPv6 ICE candidate",               0,
+    { "ignore_ipv6",        "Ignore any IPv6 ICE candidate",                            0,
         AV_OPT_TYPE_CONST,  { .i64 = WHIP_FLAG_IGNORE_IPV6 },       0, UINT_MAX, ENC, .unit = "flags" },
     { NULL },
 };
-- 
2.49.0


[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-28 15:01 [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos Jack Lau via ffmpeg-devel
@ 2025-06-28 22:49 ` Timo Rothenpieler
  2025-06-29  3:11   ` Jack Lau
  0 siblings, 1 reply; 8+ messages in thread
From: Timo Rothenpieler @ 2025-06-28 22:49 UTC (permalink / raw)
  To: ffmpeg-devel

I've actually cleaned this up a bit while trying to implement DTLS via 
schannel, and effectively removed the whole section:

> https://github.com/BtbN/FFmpeg/commit/b6794f1373fb07b791cfacd2189c7efc4d6bdbcc

There's also a bunch of other necessary UDP related fixes in tls.c.

Don't try to use an http proxy for UDP. It doesn't work:
> https://github.com/BtbN/FFmpeg/commit/709ce9e5c48e3a27a400cf5af35038d3f0602c8a

Properly forward the various hosts and ports to udp.c so it actually 
works when using a non-external UDP connection:
> https://github.com/BtbN/FFmpeg/commit/46375adf7d9cc61f709ab14dd2ea017995f735db


_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-28 22:49 ` Timo Rothenpieler
@ 2025-06-29  3:11   ` Jack Lau
  2025-06-29  3:14     ` Jack Lau
  0 siblings, 1 reply; 8+ messages in thread
From: Jack Lau @ 2025-06-29  3:11 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi Timo,
> On Jun 29, 2025, at 06:49, Timo Rothenpieler <timo@rothenpieler.org> wrote:
> 
> I've actually cleaned this up a bit while trying to implement DTLS via schannel, and effectively removed the whole section:
> 
>> https://github.com/BtbN/FFmpeg/commit/b6794f1373fb07b791cfacd2189c7efc4d6bdbcc
> 
> There's also a bunch of other necessary UDP related fixes in tls.c.
> 
> Don't try to use an http proxy for UDP. It doesn't work:
>> https://github.com/BtbN/FFmpeg/commit/709ce9e5c48e3a27a400cf5af35038d3f0602c8a
I totally agree with the above two patches, it’s very reasonable
> 
> Properly forward the various hosts and ports to udp.c so it actually works when using a non-external UDP connection:
>> https://github.com/BtbN/FFmpeg/commit/46375adf7d9cc61f709ab14dd2ea017995f735db
But I think this patch need a bit modify, I think the c->listen stands for FFmpeg if is server. When it is true, FFmpeg as server. 
So maybe:
        if (c->listen) {
            av_dict_set_int(options, "localport", port, 0);
            av_dict_set(options, "localaddr", c->underlying_host, 0);Add commentMore actions
        } else {
            av_dict_set_int(options, "connect", 1, 0);
        }
What do you think?
If you don’t mind, I’m glad to fix this and submit it to mail list.

BTW, do you have other comments for this patchset https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345948.html  <https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345948.html?> ?
I think we can merge that firstly because this patchset is simple and I want to submit WHIP NACK patch that depends these patch.

Best regards
Jack
> 
> 
> _______________________________________________
> 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".

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-29  3:11   ` Jack Lau
@ 2025-06-29  3:14     ` Jack Lau
  2025-06-29 11:47       ` Timo Rothenpieler
  0 siblings, 1 reply; 8+ messages in thread
From: Jack Lau @ 2025-06-29  3:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> On Jun 29, 2025, at 11:11, Jack Lau <jacklau1222gm@gmail.com> wrote:
> 
> Hi Timo,
>> On Jun 29, 2025, at 06:49, Timo Rothenpieler <timo@rothenpieler.org> wrote:
>> 
>> I've actually cleaned this up a bit while trying to implement DTLS via schannel, and effectively removed the whole section:
>> 
>>> https://github.com/BtbN/FFmpeg/commit/b6794f1373fb07b791cfacd2189c7efc4d6bdbcc
>> 
>> There's also a bunch of other necessary UDP related fixes in tls.c.
>> 
>> Don't try to use an http proxy for UDP. It doesn't work:
>>> https://github.com/BtbN/FFmpeg/commit/709ce9e5c48e3a27a400cf5af35038d3f0602c8a
> I totally agree with the above two patches, it’s very reasonable
>> 
>> Properly forward the various hosts and ports to udp.c so it actually works when using a non-external UDP connection:
>>> https://github.com/BtbN/FFmpeg/commit/46375adf7d9cc61f709ab14dd2ea017995f735db
> But I think this patch need a bit modify, I think the c->listen stands for FFmpeg if is server. When it is true, FFmpeg as server. 
> So maybe:
>         if (c->listen) {
>             av_dict_set_int(options, "localport", port, 0);
>             av_dict_set(options, "localaddr", c->underlying_host, 0);Add commentMore actions
>         } else {
>             av_dict_set_int(options, "connect", 1, 0);
>         }
Sry for forgetting modify this code, the right code I want to express is that:
        if (c->listen) {
            av_dict_set_int(options, "connect", 1, 0);
        } else {
            av_dict_set_int(options, "localport", port, 0);
            av_dict_set(options, "localaddr", c->underlying_host, 0);
        }

c->listen is true, ffmpeg as server
> What do you think?
> If you don’t mind, I’m glad to fix this and submit it to mail list.
> 
> BTW, do you have other comments for this patchset https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345948.html  <https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345948.html?> ?
> I think we can merge that firstly because this patchset is simple and I want to submit WHIP NACK patch that depends these patch.
> 
> Best regards
> Jack
>> 
>> 
>> _______________________________________________
>> 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".
> 

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-29  3:14     ` Jack Lau
@ 2025-06-29 11:47       ` Timo Rothenpieler
  2025-06-29 13:18         ` Jack Lau
  0 siblings, 1 reply; 8+ messages in thread
From: Timo Rothenpieler @ 2025-06-29 11:47 UTC (permalink / raw)
  To: ffmpeg-devel

On 29.06.2025 05:14, Jack Lau wrote:
> 
> 
>> On Jun 29, 2025, at 11:11, Jack Lau <jacklau1222gm@gmail.com> wrote:
>>
>> Hi Timo,
>>> On Jun 29, 2025, at 06:49, Timo Rothenpieler <timo@rothenpieler.org> wrote:
>>>
>>> I've actually cleaned this up a bit while trying to implement DTLS via schannel, and effectively removed the whole section:
>>>
>>>> https://github.com/BtbN/FFmpeg/commit/b6794f1373fb07b791cfacd2189c7efc4d6bdbcc
>>>
>>> There's also a bunch of other necessary UDP related fixes in tls.c.
>>>
>>> Don't try to use an http proxy for UDP. It doesn't work:
>>>> https://github.com/BtbN/FFmpeg/commit/709ce9e5c48e3a27a400cf5af35038d3f0602c8a
>> I totally agree with the above two patches, it’s very reasonable
>>>
>>> Properly forward the various hosts and ports to udp.c so it actually works when using a non-external UDP connection:
>>>> https://github.com/BtbN/FFmpeg/commit/46375adf7d9cc61f709ab14dd2ea017995f735db
>> But I think this patch need a bit modify, I think the c->listen stands for FFmpeg if is server. When it is true, FFmpeg as server.
>> So maybe:
>>          if (c->listen) {
>>              av_dict_set_int(options, "localport", port, 0);
>>              av_dict_set(options, "localaddr", c->underlying_host, 0);Add commentMore actions
>>          } else {
>>              av_dict_set_int(options, "connect", 1, 0);
>>          }
> Sry for forgetting modify this code, the right code I want to express is that:
>          if (c->listen) {
>              av_dict_set_int(options, "connect", 1, 0);
>          } else {
>              av_dict_set_int(options, "localport", port, 0);
>              av_dict_set(options, "localaddr", c->underlying_host, 0);
>          }

It goes together with
> https://github.com/BtbN/FFmpeg/commit/6fc902eb75554e6ad91a2ddf4ce1d131feee6f55

Without setting the localport to 0 in client-mode in combination with 
above patch, it'll try to bind to the port passed in the URL, which when 
tryong to connect to a server on localhost will result in a bind 
failure, cause it tried to bind to the same port.

And "connect" in listen mode makes no sense to me?
There is no remote address, where would it "connect" the socket to?
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-29 11:47       ` Timo Rothenpieler
@ 2025-06-29 13:18         ` Jack Lau
  2025-06-29 14:55           ` Timo Rothenpieler
  0 siblings, 1 reply; 8+ messages in thread
From: Jack Lau @ 2025-06-29 13:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> On Jun 29, 2025, at 19:47, Timo Rothenpieler <timo@rothenpieler.org> wrote:
> 
> On 29.06.2025 05:14, Jack Lau wrote:
>>> On Jun 29, 2025, at 11:11, Jack Lau <jacklau1222gm@gmail.com> wrote:
>>> 
>>> Hi Timo,
>>>> On Jun 29, 2025, at 06:49, Timo Rothenpieler <timo@rothenpieler.org> wrote:
>>>> 
>>>> I've actually cleaned this up a bit while trying to implement DTLS via schannel, and effectively removed the whole section:
>>>> 
>>>>> https://github.com/BtbN/FFmpeg/commit/b6794f1373fb07b791cfacd2189c7efc4d6bdbcc
>>>> 
>>>> There's also a bunch of other necessary UDP related fixes in tls.c.
>>>> 
>>>> Don't try to use an http proxy for UDP. It doesn't work:
>>>>> https://github.com/BtbN/FFmpeg/commit/709ce9e5c48e3a27a400cf5af35038d3f0602c8a
>>> I totally agree with the above two patches, it’s very reasonable
>>>> 
>>>> Properly forward the various hosts and ports to udp.c so it actually works when using a non-external UDP connection:
>>>>> https://github.com/BtbN/FFmpeg/commit/46375adf7d9cc61f709ab14dd2ea017995f735db
>>> But I think this patch need a bit modify, I think the c->listen stands for FFmpeg if is server. When it is true, FFmpeg as server.
>>> So maybe:
>>>         if (c->listen) {
>>>             av_dict_set_int(options, "localport", port, 0);
>>>             av_dict_set(options, "localaddr", c->underlying_host, 0);Add commentMore actions
>>>         } else {
>>>             av_dict_set_int(options, "connect", 1, 0);
>>>         }
>> Sry for forgetting modify this code, the right code I want to express is that:
>>         if (c->listen) {
>>             av_dict_set_int(options, "connect", 1, 0);
>>         } else {
>>             av_dict_set_int(options, "localport", port, 0);
>>             av_dict_set(options, "localaddr", c->underlying_host, 0);
>>         }
> 
> It goes together with
>> https://github.com/BtbN/FFmpeg/commit/6fc902eb75554e6ad91a2ddf4ce1d131feee6f55
> 
> Without setting the localport to 0 in client-mode in combination with above patch, it'll try to bind to the port passed in the URL, which when tryong to connect to a server on localhost will result in a bind failure, cause it tried to bind to the same port.
I also found this issue, I’m not sure modify the udp code if is suitable, but I can provide a workaround:

@@ -127,23 +127,22 @@ 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,
+    ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf,
+                               c->is_dtls ? (c->listen ? AVIO_FLAG_READ : AVIO_FLAG_WRITE) : AVIO_FLAG_READ_WRITE,
                                &parent->interrupt_callback, options,
                                parent->protocol_whitelist, parent->protocol_blacklist, parent);
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 2a3905891d..9cc5acd3e1 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -985,6 +985,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
             av_log(p, AV_LOG_ERROR, "Failed to connect %s\n", url);
             return ret;
         }
+        /* Make the socket non-blocking, set to READ and WRITE mode after connected */
+        ff_socket_nonblock(ffurl_get_file_handle(p->tls_shared.udp), 1);
+        p->tls_shared.udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_WRITE | AVIO_FLAG_NONBLOCK;
     }
 
> 
> And "connect" in listen mode makes no sense to me?
> There is no remote address, where would it "connect" the socket to?
Oops! I got it mixed up.
You’re right.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe".

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-29 13:18         ` Jack Lau
@ 2025-06-29 14:55           ` Timo Rothenpieler
  2025-06-29 15:12             ` Nicolas George
  0 siblings, 1 reply; 8+ messages in thread
From: Timo Rothenpieler @ 2025-06-29 14:55 UTC (permalink / raw)
  To: ffmpeg-devel

On 29.06.2025 15:18, Jack Lau wrote:
> 
> 
>> On Jun 29, 2025, at 19:47, Timo Rothenpieler <timo@rothenpieler.org> wrote:
>>
>> On 29.06.2025 05:14, Jack Lau wrote:
>>>> On Jun 29, 2025, at 11:11, Jack Lau <jacklau1222gm@gmail.com> wrote:
>>>>
>>>> Hi Timo,
>>>>> On Jun 29, 2025, at 06:49, Timo Rothenpieler <timo@rothenpieler.org> wrote:
>>>>>
>>>>> I've actually cleaned this up a bit while trying to implement DTLS via schannel, and effectively removed the whole section:
>>>>>
>>>>>> https://github.com/BtbN/FFmpeg/commit/b6794f1373fb07b791cfacd2189c7efc4d6bdbcc
>>>>>
>>>>> There's also a bunch of other necessary UDP related fixes in tls.c.
>>>>>
>>>>> Don't try to use an http proxy for UDP. It doesn't work:
>>>>>> https://github.com/BtbN/FFmpeg/commit/709ce9e5c48e3a27a400cf5af35038d3f0602c8a
>>>> I totally agree with the above two patches, it’s very reasonable
>>>>>
>>>>> Properly forward the various hosts and ports to udp.c so it actually works when using a non-external UDP connection:
>>>>>> https://github.com/BtbN/FFmpeg/commit/46375adf7d9cc61f709ab14dd2ea017995f735db
>>>> But I think this patch need a bit modify, I think the c->listen stands for FFmpeg if is server. When it is true, FFmpeg as server.
>>>> So maybe:
>>>>          if (c->listen) {
>>>>              av_dict_set_int(options, "localport", port, 0);
>>>>              av_dict_set(options, "localaddr", c->underlying_host, 0);Add commentMore actions
>>>>          } else {
>>>>              av_dict_set_int(options, "connect", 1, 0);
>>>>          }
>>> Sry for forgetting modify this code, the right code I want to express is that:
>>>          if (c->listen) {
>>>              av_dict_set_int(options, "connect", 1, 0);
>>>          } else {
>>>              av_dict_set_int(options, "localport", port, 0);
>>>              av_dict_set(options, "localaddr", c->underlying_host, 0);
>>>          }
>>
>> It goes together with
>>> https://github.com/BtbN/FFmpeg/commit/6fc902eb75554e6ad91a2ddf4ce1d131feee6f55
>>
>> Without setting the localport to 0 in client-mode in combination with above patch, it'll try to bind to the port passed in the URL, which when tryong to connect to a server on localhost will result in a bind failure, cause it tried to bind to the same port.
> I also found this issue, I’m not sure modify the udp code if is suitable, but I can provide a workaround:

The udp.c code clearly is lacking for this, so fixing it seems the right 
course of action to me.
We shouldn't be working around our own code.

> @@ -127,23 +127,22 @@ 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,
> +    ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf,
> +                               c->is_dtls ? (c->listen ? AVIO_FLAG_READ : AVIO_FLAG_WRITE) : AVIO_FLAG_READ_WRITE,

That does seem like a crude hack-around to me at best.
Since a DTLS UDP socket will always be AVIO_FLAG_READ_WRITE, since the 
communications is unavoidably two-way.

It seems much better to me to adjust udp.c to properly support two-way 
communication.
There's also other issues, like the fifo it sets up for the packet 
processing thread will happily be used by both the udp_read and write 
functions if it's there, causing absolute chaos.
> https://github.com/FFmpeg/FFmpeg/commit/8d3096f7ac7c2a9193dac901a5f6b9d604a68882
In theory it could also launch both rx and tx queue now, but I focused 
on fixing the interference first.

There's other places where it clearly assumes to only ever be used for 
reading or writing, never both. DTLS might be the first instance of that 
no longer holding true.

You can see the full set of patches here:
> https://github.com/FFmpeg/FFmpeg/compare/master...BtbN:FFmpeg:schannel_dtls

There's a bunch more udp.c related enhancements and fixes.
Like, actually being able to find out who just sent a packet (schannel 
demands the clients sockaddr to do anything when in server mode).

The schannel dtls code works in client mode already (i.e. I can stream 
to an openssl s_server -dtls with it).
But for server mode _something_ is going wrong with loading the servers 
certificate, and I haven't figured out what it is yet.

>                                  &parent->interrupt_callback, options,
>                                  parent->protocol_whitelist, parent->protocol_blacklist, parent);
> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
> index 2a3905891d..9cc5acd3e1 100644
> --- a/libavformat/tls_openssl.c
> +++ b/libavformat/tls_openssl.c
> @@ -985,6 +985,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
>               av_log(p, AV_LOG_ERROR, "Failed to connect %s\n", url);
>               return ret;
>           }
> +        /* Make the socket non-blocking, set to READ and WRITE mode after connected */
> +        ff_socket_nonblock(ffurl_get_file_handle(p->tls_shared.udp), 1);
> +        p->tls_shared.udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_WRITE | AVIO_FLAG_NONBLOCK;
>       }
>   
>>
>> And "connect" in listen mode makes no sense to me?
>> There is no remote address, where would it "connect" the socket to?
> Oops! I got it mixed up.
> You’re right.
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe".
> 
> _______________________________________________
> 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".

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos
  2025-06-29 14:55           ` Timo Rothenpieler
@ 2025-06-29 15:12             ` Nicolas George
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas George @ 2025-06-29 15:12 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Timo Rothenpieler (HE12025-06-29):
> There's also other issues, like the fifo it sets up for the packet
> processing thread will happily be used by both the udp_read and write
> functions if it's there, causing absolute chaos.

Once again proof that we need to redesign our protocols and demuxers
around an event loop.

I intend to start a discussion about that soon.

Regards,

-- 
  Nicolas George
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-06-29 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-28 15:01 [FFmpeg-devel] [PATCH v5 3/3] avformat/whip: fix typos Jack Lau via ffmpeg-devel
2025-06-28 22:49 ` Timo Rothenpieler
2025-06-29  3:11   ` Jack Lau
2025-06-29  3:14     ` Jack Lau
2025-06-29 11:47       ` Timo Rothenpieler
2025-06-29 13:18         ` Jack Lau
2025-06-29 14:55           ` Timo Rothenpieler
2025-06-29 15:12             ` Nicolas George

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git