Opened 15 months ago

Last modified 14 months ago

#10215 new defect

Windows tcp: Starting connection attempt to <GARBAGE> port <GARBAGE>

Reported by: Korl Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Korl)

Saving RTSP stream from a chinese camera to disk with

C:\app\ffmpeg-5.1.2-full_build\bin\ffmpeg.exe -hide_banner -rtsp_transport tcp -i "rtsp://192.168.4.15:8754/11" -c copy "C:\ffmpeg_test\rec.mkv" -y -nostdin -loglevel debug

works well and produces the following log

[tcp @ 000002405c964000] No default whitelist set
[tcp @ 000002405c964000] Original list of addresses:
[tcp @ 000002405c964000] Address 192.168.4.15 port 8754
[tcp @ 000002405c964000] Interleaved list of addresses:
[tcp @ 000002405c964000] Address 192.168.4.15 port 8754
[tcp @ 000002405c964000] Starting connection attempt to 192.168.4.15 port 8754
[tcp @ 000002405c964000] Successfully connected to 192.168.4.15 port 8754

putting this same command line in a batch file and run it as service

sc create "cam_save" start= demand displayname= "cam_save" binpath= ""C:\App\svcbatch-1.4.0-win-x64\svcbatch.exe" C:\ffmpeg_test\batch_to_run.bat"

fails with

[tcp @ 000001cd0c777b80] No default whitelist set
[tcp @ 000001cd0c777b80] Original list of addresses:
[tcp @ 000001cd0c777b80] Address  ˘ź< port ÷{wÍ?
[tcp @ 000001cd0c777b80] Interleaved list of addresses:
[tcp @ 000001cd0c777b80] Address  ˘ź< port ÷{wÍ?
[tcp @ 000001cd0c777b80] Starting connection attempt to  ˘ź< port "2üÍ?
[tcp @ 000001cd0c777b80] Connected attempt failed: Error number -10106 occurred
[tcp @ 000001cd0c777b80] Connection to tcp://192.168.4.15:8754?timeout=0 failed: Error number -10106 occurred
rtsp://192.168.4.15:8754/11: Unknown error

I'm guessing it is a security issue with windows services (don't know which) but I guess the garbage displayed is a memory leak.

Reproduced on two different PC's with windows builds taken from Gyan and BtbN 5.x and 4.x

Change History (1)

comment:1 by Korl, 14 months ago

Description: modified (diff)

I found out that this case appears if %SystemRoot% is not defined.
msock.dll cannot be loaded and none of the socket functions work.

in file libavformat/network.c

            getnameinfo(addrs->ai_addr, addrs->ai_addrlen,
                        hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
                        NI_NUMERICHOST | NI_NUMERICSERV);
            av_log(h, AV_LOG_VERBOSE, "Starting connection attempt to %s port %s\n",
                                      hostbuf, portbuf);
            last_err = start_connect_attempt(&attempts[nb_attempts], &addrs,
                                             timeout_ms_per_address, h,
                                             customize_fd, customize_ctx);

result of getnameinfo() should be checked before continuing.

Note: See TracTickets for help on using tickets.