lHumaNl / EchoWarp

13 stars 0 forks source link

Program crashes #22

Open SakiBiAnNya opened 2 months ago

SakiBiAnNya commented 2 months ago

Hello, I am using the program you developed, but I don’t know why it crashes after the step "Select thread workers count (default=1)". Can you help me? 屏幕截图 2024-05-18 163105

lHumaNl commented 2 months ago

@SakiBiAnNya Yes, I understand the problem. I will fix it in the next release (sometime next week).

lHumaNl commented 1 month ago

@SakiBiAnNya I apologize for such a long fix. There was a lot of work, and I almost completely redesigned the project. Try the current version (0.3.0). It should resolve your issue, but if it doesn't, I've included an option to select a custom encoding, which you can specify at startup, or you can disable encoding translation altogether (but in this case, audio devices might be displayed incorrectly in the console).

SakiBiAnNya commented 1 month ago

Thank you for fixing it, but when I tried, it seems like it's unable to connect to the virtual private IP assigned by my virtual networking software. I've confirmed that the firewall is allowing it through, and my Moonlight can connect to the host via IP address 10.6.22.2. On my host side, the IP is 10.6.22.2, and on the client side, it's 10.6.22.3. On the client side, I've already set up the EchoWarp service and it's waiting for the host to connect so that I can use the client's microphone.

Log: Select id of founded config files:

  1. 1.conf
  2. 111.conf Empty field for default value (default=Skip configs): 2 [2024-06-01 09:27:38] INFO | module: main | funcName: run_app | Start EchoWarp in client mode

[2024-06-01 09:27:38] CRITICAL | module: main | funcName: main | An error occurred: [WinError 10049] 在其上下文中,该请 求的地址无效。

[2024-06-01 09:27:38] CRITICAL | module: main | funcName: main | An error occurred: [WinError 10049] In its context, the requested address is invalid.

Traceback (most recent call last): File "main.py", line 70, in main File "main.py", line 50, in run_app File "streamer\audio_client.py", line 31, in init File "auth_and_heartbeat\transport_client.py", line 32, in init

OSError: [WinError 10049] 在其上下文中,该请求的地址无效。

OSError: [WinError 10049] In its context, the requested address is invalid.

Press Enter to exit...

Config: [echowarp_conf] is_server=False is_input_audio_device=False device_id=7 ignore_device_encoding_names=True is_error_log=True server_address=10.6.22.3

SakiBiAnNya commented 1 month ago

Select id of founded config files:

  1. 1.conf
  2. 111.conf Empty field for default value (default=Skip configs):

Select id of error file logger switcher:

  1. Disable error file log
  2. Enable error file log Empty field for default value (default=Disable error file log): 2 Select id of util mode:
  3. Server mode
  4. Client mode Empty field for default value (default=Server mode): 2 Select id of size of socket buffer:
  5. 6144
  6. Custom size Empty field for default value (default=6144): 1 Select id of capture audio device type:
  7. Input audio device
  8. Output audio device Empty field for default value (default=Input audio device): 2 Select UDP port for audio streaming (default=4415): 4415 Input password, if needed: Select count of reconnect attempt (default=5): 5 Select id of ignore audio device encoding names:
  9. Enable encoding
  10. Disable encoding Empty field for default value (default=Enable encoding): 2 Select id of audio device charset encoding names:
  11. Locale of OS - cp936
  12. Use custom encoding Empty field for default value (default=Locale of OS - cp936): 1 Select server host: 10.6.22.3 [2024-06-01 09:49:20] INFO | module: audio_device | funcName: __print_list_of_audio_devices | Select id of Output audio devices: 3: 扬声器 (Realtek(R) Audio), Channels: 8, Sample rate: 44100Hz 7: 扬声器 (Realtek(R) Audio), Channels: 8, Sample rate: 44100Hz 8: 扬声器 (Realtek(R) Audio), Channels: 2, Sample rate: 48000Hz 3 Select id of save selected values to config file:
  13. Save values to config file
  14. Skip saving params Empty field for default value (default=Skip saving params): 1 Input config file name: 2 [2024-06-01 09:49:30] INFO | module: config_parser | funcName: save_config | Config file successfully saved in "2.conf" [2024-06-01 09:49:30] INFO | module: main | funcName: run_app | Start EchoWarp in client mode [2024-06-01 09:49:30] CRITICAL | module: main | funcName: main | An error occurred: [WinError 10049] 在其上下文中,该请 求的地址无效。 Traceback (most recent call last): File "main.py", line 70, in main File "main.py", line 50, in run_app File "streamer\audio_client.py", line 31, in init__ File "auth_and_heartbeat\transport_client.py", line 32, in init OSError: [WinError 10049] 在其上下文中,该请求的地址无效。 Press Enter to exit...
lHumaNl commented 1 month ago

@SakiBiAnNya I think the problem lies in the incorrect use of the utility. I will update the README.md later to clarify this. The utility instance needs to be run both on the client and the server, with the server being started first. If the client cannot connect to the server, it will give an error, which seems to be the case here. The server is the host where the audio stream will be captured (in your case, the microphone, and this host with Moonlight). The client is the host where the captured audio stream from the server will be transmitted over the network (i.e., the host with Sunshine/Nvidia GameStream). Also, in interactive mode (where it offers a choice of values), you do not need to manually enter the default values. Simply leave the input field empty and press Enter, and it will automatically accept the default value.

P.S. Also, possibly check the firewall, as the utility uses two ports. UDP (for audio streaming) and TCP (for authentication/configuration exchange and connection status checking). If you specify port 4415 for UDP in the settings, then port 4414 (-1) will be used for TCP.

lHumaNl commented 1 month ago

On my host side, the IP is 10.6.22.2, and on the client side, it's 10.6.22.3 Config: [echowarp_conf] is_server=False is_input_audio_device=False device_id=7 ignore_device_encoding_names=True is_error_log=True server_address=10.6.22.3

Change server address in config. (server_address=10.6.22.2)

lHumaNl commented 1 month ago

@SakiBiAnNya It's worked?

SakiBiAnNya commented 1 month ago

@SakiBiAnNya It's worked?

Sorry, I've been busy lately. I'll test tomorrow

SakiBiAnNya commented 1 month ago

@SakiBiAnNya It's worked? It still doesn't work. My firewall has added UDP 4415 and TCP 4414 ports for clearance. And isn't the party being used the host side? My Moonlight client has created the EchoWarp capture microphone sound stream service, but my Sunshine host cannot connect to it 5c1c693b08fc8ec19c5e0ed65ce05193_看图王

/10.6.22.1 to 10.6.22.3/

Select server host: 10.6.22.3 [2024-06-04 19:13:46] INFO | module: audio_device | funcName: __print_list_of_audio_devices | Select id of Output audio devices: 1: 扬声器 (Realtek(R) Audio), Channels: 8, Sample rate: 44100Hz 3: 扬声器 (Realtek(R) Audio), Channels: 8, Sample rate: 44100Hz 4: 扬声器 (Realtek(R) Audio), Channels: 2, Sample rate: 48000Hz 4 Select id of save selected values to config file:

  1. Save values to config file
  2. Skip saving params Empty field for default value (default=Skip saving params): 1 Input config file name: 99 [2024-06-04 19:13:57] INFO | module: config_parser | funcName: save_config | Config file successfully saved in "99.conf" [2024-06-04 19:13:57] INFO | module: main | funcName: run_app | Start EchoWarp in client mode [2024-06-04 19:13:57] CRITICAL | module: main | funcName: main | An error occurred: [WinError 10049] 在其上下文中,该请 求的地址无效。 Traceback (most recent call last): File "main.py", line 70, in main File "main.py", line 50, in run_app File "streamer\audio_client.py", line 31, in init__ File "auth_and_heartbeat\transport_client.py", line 32, in init OSError: [WinError 10049] 在其上下文中,该请求的地址无效。 Press Enter to exit...
lHumaNl commented 1 month ago

@SakiBiAnNya The issue is that the client cannot find the server's IP address (the OSError: [WinError 10049] indicates this). I tried specifying a non-existent IP in my subnet when connecting with the client and received the same error. This means that either additional port forwarding through the VPN might be needed, or the VPN itself is not allowing connections on these ports, or a different IP address needs to be specified. In any case, this is definitely a network problem. Try using ping, telnet, or another method to establish a connection to the host with this IP. I will make some changes to the utility in the coming days, which might address some issues (specifically, the server will log the IP addresses of all its network interfaces and the DNS name, a single TCP and UDP port will now be used for everything, and there will be minor text/documentation/log adjustments).

lHumaNl commented 1 month ago

@SakiBiAnNya I've added some fixes in release 0.3.3, annotations for server sockets and README.md. Maybe it will fix your problem. Now, you need to open only one port in your firewall for UDP and TCP.

SakiBiAnNya commented 1 month ago

@lHumaNl Thank you for your work. I can see on the server side that the client has attempted to connect, but why do I see 'The requested address is invalid in its context' on the client side? Could it be because I am using a USB sound card (an adapter cable with a DAC chip)?

10.6.22.1 [2024-06-10 19:42:49] INFO | module: main | funcName: run_app | Starting EchoWarp in client mode [2024-06-10 19:42:49] INFO | module: transport_client | funcName: _established_connection | TCP connection to 10.6.22.3 established. [2024-06-10 19:42:49] INFO | module: transport_client | funcName: __authenticate_on_server | Authentication on server completed. [2024-06-10 19:42:49] ERROR | module: main | funcName: main | [WinError 10049] 在其上下文中,该请求的地址无效。 Press Enter to exit...

10.6.22.3 [2024-06-10 19:31:42] INFO | module: transport_server | funcName: _print_udp_listener_and_start_stream | Start UDP audio streaming to client 10.6.22.1:49000 [2024-06-10 19:42:50] INFO | module: transport_server | funcName: _established_connection | Client connected from 10.6.22.1 [2024-06-10 19:42:50] INFO | module: transport_server | funcName: authenticate_client | Client 10.6.22.1 authenticated. [2024-06-10 19:42:50] INFO | module: transport_server | funcName: print_client_info | Client 10.6.22.1 info: Success client connections: 2 Failed client connection attempts after last success: 0/5 Count of failed client connections: 0 [2024-06-10 19:42:50] INFO | module: transport_server | funcName: send_configuration | Configuration sent to client. [2024-06-10 19:42:50] INFO | module: transport_server | funcName: _print_udp_listener_and_start_stream | Start UDP audio streaming to client 10.6.22.1:49000 [2024-06-10 19:42:50] ERROR | module: transport_base | funcName: start_streaming | Heartbeat message from client is NULL [2024-06-10 19:42:50] WARNING | module: transport_server | funcName: _print_pause_udp_listener_and_pause_stream | Audio streaming paused! [2024-06-10 19:42:50] INFO | module: transport_base | funcName: __reconnect | Attempting to stabilize the connection... [2024-06-10 19:42:50] ERROR | module: transport_base | funcName: retry_send_heartbeat | Heartbeat message from client is NULL [2024-06-10 19:42:50] INFO | module: transport_server | funcName: _established_connection | Authenticate server started and awaiting client connection on next INET interfaces: Interface name: 以太网, IP address: 192.168.6.131:49000, DNS: DESKTOP-QG66797.lan:49000 Interface name: natpierce, IP address: 10.6.22.3:49000, DNS: DESKTOP-QG66797.natpierce:49000

SakiBiAnNya commented 1 month ago

@lHumaNl I am using another software called 'Wo Mic' to use my phone as a microphone. It can connect to my phone using port 4415 (my phone is also connected to the virtual LAN) and successfully capture the sound from my phone's microphone. bd19ffd5d1eb4ea45c7196462c2cbfe7 34f6aeb1dbb48f4e3456ad46d3805f4b

lHumaNl commented 1 month ago

@SakiBiAnNya Okay, I changed the logic of the client's connection to the server. Now it first establishes a TCP connection, and then creates a UDP socket. Previously, it was the other way around, and that’s why it immediately threw the [WinError 10049] error. Now it correctly establishes the TCP connection, but it still cannot create a UDP socket at this address. I suspect that your VPN cannot forward UDP (or additional settings are needed for that).

You can use PsPing https://learn.microsoft.com/en-us/sysinternals/downloads/psping for checking UDP connection.

You need to forward 2 ports in the VPN: 49000 for TCP and 49000 for UDP.

lHumaNl commented 1 month ago

@SakiBiAnNya Oh... I found a bug. I'll fix it soon.

SakiBiAnNya commented 1 month ago

@lHumaNl I can pass the test on port 10.6.22.3:4415 on a remote host

D:\EchoWarp\PSTools>psping -u -i 1 -n 10 -l 1k -h 10.6.22.3:4415

PsPing v2.12 - PsPing - ping, latency, bandwidth measurement utility Copyright (C) 2012-2023 Mark Russinovich Sysinternals - www.sysinternals.com

UDP bandwidth test connecting to 10.6.22.3:4415: Connected 15 iterations (5 warmup) sending 1024 bytes UDP bandwidth te100%

UDP sender bandwidth statistics: Sent = 10, Size = 1024, Total Bytes: 10240, Minimum = 141.53 MB/s, Maximum = 141.53 MB/s, Average = 141.53 MB/s UDP receiver bandwidth statistics: Received = 6, Size = 1024, Total Bytes: 6144, Minimum = 90.73 KB/s, Maximum = 90.73 KB/s, Average = 90.73 KB/s UDP packet rate: 60.00% Not enough data for histogram. Trying increasing the request size or iteration count.

lHumaNl commented 1 month ago

@SakiBiAnNya Try, plz 0.4.0. I'll fix 2 critical bugs and one of them is your problem.

SakiBiAnNya commented 1 month ago

@lHumaNl Successfully connected, but received a strange sound

lHumaNl commented 1 month ago

@SakiBiAnNya I'll tested on this config (SSL\Integrity control Enabled): 1) Client - Output audio (speaker) 2) Server - Input audio (microphone) And sound was normal.

Later will try with all inputs.

SakiBiAnNya commented 1 month ago

@lHumaNl Oh no, there is a bug. After closing the window and reopening the connection, I will upload abnormally (upload 100m/s with large traffic), and it will also cause abnormal memory usage. The program uses a large amount of memory (12GB), causing my computer to freeze.

SakiBiAnNya commented 1 month ago

@lHumaNl It says "The process was terminated because it could not allocate more memory" Screenshot_2024-06-10-22-06-38-123_com miui gallery Screenshot_2024-06-10-22-08-22-245_com miui gallery

lHumaNl commented 1 month ago

Wow... Mem leak...