ultravideo / uvgComm

High performance P2P-Mesh video conferencing
ISC License
53 stars 14 forks source link

Kvazzup crashes when connection established #16

Closed tpanj closed 3 years ago

tpanj commented 3 years ago

Symptoms

I managed to compile the application in kubuntu20.4 (but not in kubuntu21.4) and I test ran on both systems. But whenever a video conferencing connection is established, it crashes.

Here are different logs if sound is muted or not:

$ head -n64 ERROR_*
==> ERROR_MUTE <==
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Commit message received, verify CRC32!
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Commit message received, verify CRC32!
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Confirm2 message received, verify CRC32!
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 92
[RTPLIB][DEBUG][::validate_session] All hashes match!
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][DEBUG][::derive_key] Truncate key to 128 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 112 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 128 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 112 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 128 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 112 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 128 bits!
[RTPLIB][DEBUG][::derive_key] Truncate key to 112 bits!
[RTPLIB][DEBUG][::runner] Received a corrupted packet!
[RTPLIB][DEBUG][::runner] Received a corrupted packet!
[RTPLIB][DEBUG][::runner] Received a corrupted packet!
Filter:                                 Parameter set found (Frame received before: 0)
Filter:                                 PEER ERROR: Detected no slices in incoming stream.
Filter:                                 Uniniating.
[hevc @ 0x55e0d9551550] flush, decoder_0.
Filter:                                 Starting to initiate OpenHEVC
[hevc @ 0x7f45fc005880] nb threads_frame = 1, nb threads_slice 1, thread_type = null 
[hevc @ 0x7f45fc005ec0] nb threads_frame = 1, nb threads_slice 1, thread_type = null 
Filter:                                 OpenHEVC initiation successful. (Version: OpenHEVC v2.0)
[RTPLIB][DEBUG][::call_aux_handlers] Received a corrupted packet!
[RTPLIB][DEBUG][::call_aux_handlers] Received a corrupted packet!
Illegal instruction (core dumped)

==> ERROR_SOUND <==
[RTPLIB][DEBUG][::runner] Received a corrupted packet!
[RTPLIB][DEBUG][::runner] Received a corrupted packet!
[RTPLIB][DEBUG][::call_aux_handlers] Received a corrupted packet!
Filter:                                 Parameter set found (Frame received before: 0)
Filter:                                 PEER ERROR: Detected no slices in incoming stream.
Filter:                                 Uniniating.
[hevc @ 0x55b125615500] flush, decoder_0.
Filter:                                 Starting to initiate OpenHEVC
[hevc @ 0x7f1980022fb0] nb threads_frame = 1, nb threads_slice 1, thread_type = null 
[hevc @ 0x7f1980040150] nb threads_frame = 1, nb threads_slice 1, thread_type = null 
Filter:                                 OpenHEVC initiation successful. (Version: OpenHEVC v2.0)
[RTPLIB][DEBUG][::call_aux_handlers] Received a corrupted packet!
SpeexAEC:                               Warning! We haven't buffered enough audio samples to start echo cancellation (Buffered: 5/6)
SpeexAEC:                               Warning! We haven't buffered enough audio samples to start echo cancellation (Buffered: 5/6)
SpeexAEC:                               Warning! We haven't buffered enough audio samples to start echo cancellation (Buffered: 5/6)
SpeexAEC:                               Warning! We haven't buffered enough audio samples to start echo cancellation (Buffered: 5/6)
SpeexAEC:                               Warning! We haven't buffered enough audio samples to start echo cancellation (Buffered: 5/6)
Illegal instruction (core dumped)

Reproduction

  1. run compiled kvazzup on two PCs and configure with no proxy to run on LAN
  2. configure to set peer's IP
  3. call peer computer and answer there
  4. you will get core dumped. If sound is either enabled or not I received different messages

Environment

Suspected Cause (optional)

It is probably something wrong handling low level communication packets or operations with those packets; maybe openHEVC?

Possibly a problem with setting the resolution for Kvazaar filter?

jrsnen commented 3 years ago

Hello!

Thanks for your interest in Kvazzup and for submitting this bug report. Unfortunately, I can't determine what the problem is yet. If I had to guess, it would have something to do with the way Kvazzup sets the resolution for the camera or Kvazaar since there are some special cases on Linux because of a bug in Qt (I should probably take the time to submit a bug report to Qt).

I have a few questions that might help us determine the cause of the problem: 1) I'm guessing this repeats every time? 2) Does it work if you start the call without video enabled? 3) Does it work if you enable screen sharing before calling? 4) Do you have a camera on both machines?

It would be really helpful if you could run this through a debugger to get the location of the crash.

Also, attaching file kvazzup.log and kvazzup.ini might help solve this issue if there is nothing too private in them.

fador commented 3 years ago

Since the Illegal instruction (core dumped), it might also be because AVX2 instructions are used, if the CPU does not support those? I'm not sure if there's any detection for AVX2, but the YUV to RGB uses those instructions and the selection is handled at: https://github.com/ultravideo/kvazzup/blob/master/src/media/processing/yuvtorgb32.cpp#L50

jrsnen commented 3 years ago

@fador That is a good point also! There is no detection for AVX2 at the moment, although they can be disabled here. It might be worth testing.

tpanj commented 3 years ago

1. Yes, this crashes every time. Here are logs.

kvazzup.log kvazzup.ini.txt From second computer who had core dump: kvazzup2.log kvazzup2.ini.txt

2. If I start call without video it works.

3. It works with issue

As you can see screensharing probably only have resolution problem. Is there a way to configure that (see log)?

console2.log Screenshot_20210929_142749

4. Yes, camera is on both machines.

5. Audio works but with warning:

AudioOutputDevice: Warning! No output audio frame available in time. Repeating previous audio frame (Consecutive repeats: 1) AudioOutputDevice: Warning! No output audio frame available in time. Repeating previous audio frame (Consecutive repeats: 2) AudioOutputDevice: Warning! No output audio frame available in time. Repeating previous audio frame (Consecutive repeats: 3) AudioOutputDevice: Warning! The output device buffer is too large. Dropping audio frames (Buffer Status: 15/10) AudioOutputDevice: Warning! The output device buffer is too large. Dropping audio frames (Buffer Status: 14/10) AudioOutputDevice: Warning! The output device buffer is too large. Dropping audio frames (Buffer Status: 13/10)

jrsnen commented 3 years ago

We noticed that you don't have support for AVX2 instruction in your CPU. This is a likely cause of this crash. I will try to implement a system for enabling and disabling the code based on supported instructions next week.

There was a missing variable check in the code for avx2. Could you try disabling the avx2 variable with the newest master to verify that this is the issue? The line is located here, in case you missed it.

The audio warnings are pretty normal. Only if there are a lot of those errors, it becomes a problem. Each warning tells about one lost audio sample. The audio is pretty precise stuff since buffering causes latency and not buffering means that if a sample is too late, we have to play something.

That screen sharing bug is an interesting one. I have no idea what is going on there. I have to do more testing on Linux to find out what is causing that.

tpanj commented 3 years ago

Thanks to your help I set in that line to false and after building software I was able to make a proper video call from one to another computer.

Just ping me if you want me to do Linux testing.

jrsnen commented 3 years ago

@tpanj I pushed an automated system (4f825d45bbebc41c9dd3a411f52b9f5e6b6031b1) for detecting which optimizations are available. Can you verify that this issue has been solved by the commit?

tpanj commented 3 years ago

Yes - works for me. Thanks!