MarshalX / tgcalls

Voice chats, private incoming and outgoing calls in Telegram for Developers
https://t.me/tgcallslib
GNU Lesser General Public License v3.0
514 stars 91 forks source link

get_raw_group_call fails with incompatible constructor arguments #179

Closed gotschi closed 2 years ago

gotschi commented 2 years ago

using tgcalls 3.0.0.dev22,

works with pyrogram 1.2.5 but not with anything > 1.2.5. Telegram does not allow login with 1.2.5 anymore - i tried a session db created with 1.2.11 but apparently a db from 1.2.11 is not compatible with 1.2.5

running the example from https://github.com/MarshalX/tgcalls/blob/main/examples/restream_using_raw_data.py also results:

tgcalls | init(): incompatible constructor arguments. The following argument types are supported: tgcalls | 1. tgcalls.NativeInstance(arg0: bool, arg1: str) tgcalls | tgcalls | Invoked with: None, 128 tgcalls | Traceback (most recent call last): tgcalls | File "/usr/local/lib/python3.10/site-packages/pyrogram/dispatcher.py", line 240, in handler_worker tgcalls | await handler.callback(self.client, *args) tgcalls | File "/app/app.py", line 105, in print_updates tgcalls | call = await voicecall(client, channelfrom, channelto, False) tgcalls | File "/app/app.py", line 197, in voicecall tgcalls | group_call_from = group_call_factory.get_raw_group_call(on_recorded_data=on_recorded_data) tgcalls | File "/usr/local/lib/python3.10/site-packages/pytgcalls/group_call_factory.py", line 130, in get_raw_group_call tgcalls | return GroupCallRaw( tgcalls | File "/usr/local/lib/python3.10/site-packages/pytgcalls/implementation/group_call_raw.py", line 38, in init tgcalls | super().init(mtproto_bridge, enable_logs_to_console, path_to_log_file, outgoing_audio_bitrate_kbit) tgcalls | File "/usr/local/lib/python3.10/site-packages/pytgcalls/implementation/group_call_base.py", line 88, in init tgcalls | GroupCallNative.init( tgcalls | File "/usr/local/lib/python3.10/site-packages/pytgcalls/implementation/group_call_native.py", line 61, in init tgcalls | self.__native_instance = tgcalls.NativeInstance(enable_logs_to_console, path_to_log_file) tgcalls | TypeError: init(): incompatible constructor arguments. The following argument types are supported: tgcalls | 1. tgcalls.NativeInstance(arg0: bool, arg1: str) tgcalls | tgcalls | Invoked with: None, 128

do you have a quick fix?

gotschi commented 2 years ago

no reply at all?

how can one get the restream example to work without 1.2.5? Thanks

MarshalX commented 2 years ago

Is it you was in telegram chat? I guess yes. You cant reproduce it... Also you switched to telethon... Should we continue to work on this issue?

gotschi commented 2 years ago

yes, this was me.

I switched to Telethon where group_call_factory.get_raw_group_call() is correctly initialized, but that still leaves pytgcalls unable to start a raw call beginning from pytgcalls >= 3.00 and pyrogram >= 1.2.5

The exact same call works with telethon, however only one audio stream gets played some time most of the time it does not play the stream on the other end but doesn't fail either. i cannot catch it with telethon Telethon btw also fails to start a raw call on pytgcalls>=2.1

currently looks like this: https://paste.debian.net/1240329/ please excuse the horrible code but please can you tell me why the audio only sometimes gets to channel_to but most of the time fails? 2 way also never works.

while get_raw_group_call(), the restream example and 2way audio worked fine with pyrogram 1.2.5 I cannot get it to work anymore with a new account (pyrogram >= 1.2.11 needed to login, session file incompatible with 1.2.5)

can get you the output files of GroupCallFactory if needed

gotschi commented 2 years ago

I'd be very happy if you could provide a restream example working with 3.0.0 because right now everything raw fails with 3.0.0* for me

only get_group_call() works as in the video example given for dev

gotschi commented 2 years ago

seems like the problem lies in /pytgcalls/implementation/group_call_raw.py:38

when replaced with super().__init__(mtproto_bridge, False, None, outgoing_audio_bitrate_kbit)

it initializes pytgcall but fails with: terminate called after throwing an instance of 'pybind11::cast_error' what(): Unable to cast Python instance to C++ type (compile in debug mode for details)

gotschi commented 2 years ago

changing https://github.com/MarshalX/tgcalls/blob/dev/pytgcalls/pytgcalls/implementation/group_call_native.py#L61 to self.__native_instance = tgcalls.NativeInstance(True, "")

results in

tgcalls v3.0.0.5 DEV, Copyright (C) 2020-2021 Il`ya (Marshal) <https://github.com/MarshalX>
Licensed under the terms of the GNU Lesser General Public License v3 (LGPLv3)

[OpenH264] this = 0x0x7f033c0011b0, Warning:Change QP Range from(0,51) to (12,42)
[OpenH264] this = 0x0x7f033c001930, Warning:Change QP Range from(0,51) to (12,42)
[OpenH264] this = 0x0x7f033d133a70, Warning:Change QP Range from(0,51) to (12,42)
[OpenH264] this = 0x0x7f0348001490, Warning:Change QP Range from(0,51) to (12,42)
[OpenH264] this = 0x0x7f0348001c10, Warning:Change QP Range from(0,51) to (12,42)
[OpenH264] this = 0x0x7f0349133cb0, Warning:Change QP Range from(0,51) to (12,42)
[bnd] Waiting for 5 seconds before continuing (required by "phone.JoinGroupCall")
[bnd] Waiting for 3 seconds before continuing (required by "phone.EditGroupCallParticipant")
[OpenH264] this = 0x0x7f033d133a70, Warning:Actual input framerate 0.000000 is different from framerate in setting 12.000000, suggest to use other rate control modes
[OpenH264] this = 0x0x7f033c001930, Warning:Actual input framerate 0.000000 is different from framerate in setting 12.000000, suggest to use other rate control modes
[OpenH264] this = 0x0x7f033c0011b0, Warning:Actual input framerate 0.000000 is different from framerate in setting 12.000000, suggest to use other rate control modes

call is started but no audio throughput and execution seems to fail but not sure

here is the full output: https://x0.at/jhvU.txt