Bug 266006

Summary: net/linphone: 4.4.8_1 crashes on camera access
Product: Ports & Packages Reporter: Ruslan Zalata <rz>
Component: Individual Port(s)Assignee: Felix Palmen <zirias>
Status: Closed FIXED    
Severity: Affects Only Me CC: bofh, rz
Priority: --- Flags: zirias: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 266008, 266017    
Bug Blocks:    
Attachments:
Description Flags
Update linphone libs
none
Enable MSQGL filter pluging (MS Qt OpenGL) to allow camera preview to work
none
Add sanity checks to mediastreamer msfilter.c none

Description Ruslan Zalata 2022-08-23 21:50:35 UTC
I upgraded net/linphone package today to 4.4.8_1 and found that it cannot access my USB camera any more, it crashes soon as as I press "VIDEO PREVIEW", neither video calls can be made. I then upgraded all the packages using pkg -f upgrade, but that did not help. So, I "setenv CMAKE_BUILD_TYPE Debug" and recompiled linphone, linphonelibrary and mediastreamer from ports, the run it from inside GDB. It seems the bug is somewhere in meadistreamer, see backtrace below.

It used to work well before recent, though I don't remember what version it was.



rz@butterfly:~ % uname -a
FreeBSD butterfly 13.1-RELEASE-p1 FreeBSD 13.1-RELEASE-p1 GENERIC amd64

rz@butterfly:~ % pkg info linphone
linphone-4.4.8_1,1
Name           : linphone
Version        : 4.4.8_1,1
Installed on   : Wed Aug 24 00:17:06 2022 +05
Origin         : net/linphone
Architecture   : FreeBSD:13:amd64

rz@butterfly:~ % pkg info liblinphone
liblinphone-5.1.32_1
Name           : liblinphone
Version        : 5.1.32_1
Installed on   : Wed Aug 24 02:26:06 2022 +05
Origin         : net/liblinphone
Architecture   : FreeBSD:13:amd64

rz@butterfly:~ % pkg info mediastreamer
mediastreamer-5.1.43
Name           : mediastreamer
Version        : 5.1.43
Installed on   : Wed Aug 24 00:10:29 2022 +05
Origin         : net/mediastreamer
Architecture   : FreeBSD:13:amd64


rz@butterfly:~ % gdb /usr/local/bin/linphone
GNU gdb (GDB) 12.1 [GDB v12.1 for FreeBSD]
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/linphone...
(No debugging symbols found in /usr/local/bin/linphone)
(gdb) run
Starting program: /usr/local/bin/linphone 
warning: Could not load shared library symbols for [vdso].
Do you need "set solib-search-path" or "set sysroot"?
QML debugging is enabled. Only use this in a safe environment.
[New LWP 118821 of process 2187]
[New LWP 118822 of process 2187]
[New LWP 118823 of process 2187]
[New LWP 118824 of process 2187]
[New LWP 118825 of process 2187]
[New LWP 118826 of process 2187]
[New LWP 118827 of process 2187]
[New LWP 118828 of process 2187]
[New LWP 118829 of process 2187]
[New LWP 118830 of process 2187]
[New LWP 118831 of process 2187]
[New LWP 118832 of process 2187]
[New LWP 118833 of process 2187]
[New LWP 118834 of process 2187]
[New LWP 118835 of process 2187]
[New LWP 118836 of process 2187]
[New LWP 118837 of process 2187]
[New LWP 118838 of process 2187]
[New LWP 118839 of process 2187]
[New LWP 118840 of process 2187]
[New LWP 118841 of process 2187]
[New LWP 118842 of process 2187]
[New LWP 118843 of process 2187]
[New LWP 118844 of process 2187]
[New LWP 118845 of process 2187]
[New LWP 118846 of process 2187]
[New LWP 118847 of process 2187]
[New LWP 118848 of process 2187]
[New LWP 118849 of process 2187]
[New LWP 118850 of process 2187]
[02:43:06:090][0x81346e040][Info]app/App.cpp:232: "Starting Linphone (bin: linphone)"
[02:43:06:090][0x81346e040][Info]app/App.cpp:233: "Use locale: en"
[02:43:06:105][0x81346e040][Info]app/AppController.cpp:109: Available fonts :  ("Adobe Courier", "Adobe Helvetica", "Adobe New Century Schoolbook", "Adobe Times", "Adobe Utopia", "Arabic Newspaper", "Arimo", "B&H Lucida", "B&H LucidaBright", "B&H LucidaTypewriter", "Bitstream Charter", "Bitstream Terminal", "Caladea", "Carlito", "Courier", "Courier 10 Pitch", "Cousine", "Cursor", "cursor.pcf", "DEC Terminal", "deccurs.pcf", "decsess.pcf", "DejaVu Math TeX Gyre", "DejaVu Sans", "DejaVu Sans Condensed", "DejaVu Sans Mono", "DejaVu Serif", "DejaVu Serif Condensed", "Droid Arabic Kufi", "Droid Arabic Naskh", "Droid Naskh Shift Alt", "Droid Sans", "Droid Sans Arabic", "Droid Sans Armenian", "Droid Sans Ethiopic", "Droid Sans Fallback", "Droid Sans Georgian", "Droid Sans Hebrew", "Droid Sans Japanese", "Droid Sans Mono", "Droid Serif", "East Syriac Adiabene", "East Syriac Ctesiphon", "Estrangelo Antioch", "Estrangelo Edessa", "Estrangelo Midyat", "Estrangelo Nisibin", "Estrangelo Nisibin Outline", "Estrangelo Quenneshrin", "Estrangelo Talada", "Estrangelo TurAbdin", "Ets Caption", "Ets Teletext", "Ets Teletext Wide", "Gentium Basic", "Gentium Book Basic", "Goha-Tibeb Zemen", "GOST type A", "GOST Type AU", "GOST type B", "GOST Type BU", "jmk Modd", "jmk Neep", "jmk Neep Alt", "Led Fixed", "Liberation Mono", "Liberation Sans", "Liberation Serif", "Linux Biolinum G", "Linux Libertine Display G", "Linux Libertine G", "Luxi Mono [b&h]", "Luxi Mono [B&H ]", "Luxi Sans [b&h]", "Luxi Sans [B&H ]", "Luxi Serif [B&H ]", "Luxi Serif [b&h]", "micro.pcf", "Misc Fixed", "Misc Fixed Wide", "Monospace", "MUTT ClearlyU Alternate Glyphs Wide", "MUTT ClearlyU PUA", "MUTT ClearlyU Wide", "Noto Sans", "Noto Sans UI", "Sans Serif", "Schumacher Clean", "Schumacher Clean Wide", "Serif", "Serto Batnan", "Serto Jerusalem", "Serto Jerusalem Outline", "Serto Kharput", "Serto Malankara", "Serto Mardin", "Serto Urhoy", "Sony Fixed", "Symbol type A", "Symbol type B", "Tinos", "Twitter Color Emoji", "Unifont", "Unifont CSUR", "Unifont Upper", "Utopia")
[02:43:06:105][0x81346e040][Info]app/main.cpp:70: "Running app..."
[New LWP 118851 of process 2187]
[02:43:06:122][0x81346e040][Info]app/App.cpp:362: "Activated selectors:" ("custom", "C", "unix", "freebsd", "freebsd")
[02:43:06:122][0x81346e040][Info]app/App.cpp:601: "Registering types..."
[02:43:06:122][0x81346e040][Info]app/App.cpp:690: "Registering shared types..."
[02:43:06:122][0x81346e040][Info]app/App.cpp:710: "Registering tool types..."
[02:43:06:122][0x81346e040][Info]app/App.cpp:722: "Registering shared tool types..."
[02:43:06:200][0x81346e040][Info]app/App.cpp:406: "Loading main view..."
[New LWP 118852 of process 2187]
[LWP 118852 of process 2187 exited]
[02:43:06:250][0x81346e040][Info]components/core/CoreManager.cpp:262: "Launch async core creation."
[02:43:06:285][0x81346e040][Info]components/core/CoreHandlers.cpp:163: Core is starting  "Starting up"
[02:43:06:293][0x81346e040][Info]components/core/CoreHandlers.cpp:155: Core is running  "On"
[02:43:06:293][0x81346e040][Info]components/core/CoreManager.cpp:224: "Set `Friends` path: `/home/rz/.local/share/linphone/friends.db`"
[02:43:06:294][0x81346e040][Info]components/core/CoreManager.cpp:225: "Set `CallLogs` path: `/home/rz/.local/share/linphone/call-history.db`"
[02:43:06:295][0x81346e040][Info]components/core/CoreManager.cpp:239: Using ZrtpSecrets path :  "/home/rz/.local/share/linphone/zrtp-secrets.db"
[02:43:06:295][0x81346e040][Info]components/core/CoreManager.cpp:242: Using UserCertificate path :  "/home/rz/.local/share/linphone/"
[02:43:06:295][0x81346e040][Info]components/core/CoreManager.cpp:245: Using RootCa path :  "/usr/local/share/linphone/rootca.pem"
[02:43:06:295][0x81346e040][Info]components/core/CoreManager.cpp:412: "Start iterate"
[02:43:06:296][0x81346e040][Info]components/sip-addresses/SipAddressesModel.cpp:574: Sip addresses model from Chats : 0 ms.
[02:43:06:297][0x81346e040][Info]components/sip-addresses/SipAddressesModel.cpp:576: Sip addresses model from Calls : 1 ms.
[02:43:06:297][0x81346e040][Info]components/sip-addresses/SipAddressesModel.cpp:578: Sip addresses model from Refs : 0 ms.
[02:43:06:297][0x81346e040][Info]components/sip-addresses/SipAddressesModel.cpp:580: Sip addresses model from Contacts : 0 ms.
[02:43:06:297][0x81346e040][Info]components/sip-addresses/SipAddressesModel.cpp:581: Sip addresses model initialized in: 1 ms.
[02:43:06:300][0x81346e040][Info]components/core/event-count-notifier/AbstractEventCountNotifier.cpp:77: "Notify event count: 0."
[02:43:06:300][0x81346e040][Info]components/core/event-count-notifier/AbstractEventCountNotifier.cpp:77: "Notify event count: 0."
[02:43:06:300][0x81346e040][Info]components/core/CoreManager.cpp:114: "CoreManager initialized"
[New LWP 118853 of process 2187]
[New LWP 118854 of process 2187]
[LWP 118854 of process 2187 exited]
[02:43:06:372][0x81346e040][Info]app/App.cpp:956: "Open Linphone app."
[02:43:06:372][0x81346e040][Info]app/App.cpp:272: "Creating subwindow: `qrc:/ui/views/App/Calls/CallsWindow.qml`."
[02:43:06:407][0x81346e040][Info]app/App.cpp:279: "Subwindow status: `1`."
[02:43:06:420][0x81346e040][Info]app/App.cpp:272: "Creating subwindow: `qrc:/ui/views/App/Settings/SettingsWindow.qml`."
[02:43:06:445][0x81346e040][Info]app/App.cpp:279: "Subwindow status: `1`."
[New LWP 118856 of process 2187]
[New LWP 118857 of process 2187]
[02:43:06:739][0x81346e040][Info]components/core/event-count-notifier/AbstractEventCountNotifier.cpp:77: "Notify event count: 0."
[New LWP 118858 of process 2187]
[New LWP 118859 of process 2187]

Thread 39 received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
[Switching to LWP 118859 of process 2187]
0x000000080256b2f1 in ms_filter_link () from /usr/local/lib/libmediastreamer.so.11
(gdb) bt
#0  0x000000080256b2f1 in ms_filter_link () from /usr/local/lib/libmediastreamer.so.11
#1  0x00000008025bc109 in video_preview_start () from /usr/local/lib/libmediastreamer.so.11
#2  0x00000008029afb63 in ?? () from /usr/local/lib/liblinphone.so.10
#3  0x00000008029b66fc in linphone_core_get_native_preview_window_id () from /usr/local/lib/liblinphone.so.10
#4  0x00000000007a0c13 in ?? ()
#5  0x0000000800e5bae2 in QQuickFramebufferObject::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) ()
   from /usr/local/lib/qt5/libQt5Quick.so.5
#6  0x0000000800d57b19 in QQuickWindowPrivate::updateDirtyNode(QQuickItem*) () from /usr/local/lib/qt5/libQt5Quick.so.5
#7  0x0000000800d45334 in QQuickWindowPrivate::updateDirtyNodes() () from /usr/local/lib/qt5/libQt5Quick.so.5
#8  0x0000000800d44f79 in QQuickWindowPrivate::syncSceneGraph() () from /usr/local/lib/qt5/libQt5Quick.so.5
#9  0x0000000800ced7ce in ?? () from /usr/local/lib/qt5/libQt5Quick.so.5
#10 0x0000000800cecb65 in ?? () from /usr/local/lib/qt5/libQt5Quick.so.5
#11 0x0000000800cee39c in ?? () from /usr/local/lib/qt5/libQt5Quick.so.5
#12 0x0000000803272a68 in ?? () from /usr/local/lib/qt5/libQt5Core.so.5
#13 0x0000000803a9a83a in thread_start (curthread=0x829f0f200) at /usr/src/lib/libthr/thread/thr_create.c:292
#14 0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x7fffdafd9000
Comment 1 Ruslan Zalata 2022-08-23 23:26:34 UTC
Ok, I have been doing some debugging by myself. I could see that ms_filter_link() is being called with NULL in place of f2 parameter, no sanity checks are made in there!

Inside video_preview_start() call to ms_factory_create_filter_from_name(...,"MSQOGL") returns NULL which is then passed to ms_filter_call_method() and to ms_filter_link() also unchecked!

It made me wonder what is displayname = "MSQOGL" ? Has it anything to do with OpenGL ?

To figure out what displaynames I have, I added some printf()'s in ms_factory_lookup_filter_by_name(). It shows there's no "MSQOGL" display. Looks like this has to be Qt OpenGL display which is missing.

Here below is my debug output.

TEE: ms_factory_lookup_filter_by_name: searching for MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSMKVPlayer, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSMKVRecorder, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSX11Video, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVp8Dec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVp8Enc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSV4L2Capture, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSV4l, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSTheoraDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSTheoraEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSGLXVideo, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSOGL, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSJpegWriter, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSMJpegDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSJpegDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSSnowDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSH263OldDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSH263Dec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSMpeg4Dec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVideoSwitcher, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSSizeConv, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSPixConv, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSStaticImage, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSMire, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSAnalyseDisplay, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSExtDisplay, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSSpeexEC, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSSpeexEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSSpeexDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSResample, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSOpusDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSOpusEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSGsmEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSGsmDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSBCG729Enc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSBCG729Dec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSOssWrite, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSOssRead, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSUdpSend, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSRTT4103Sink, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSRTT4103Source, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSRtpRecv, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSRtpSend, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSUlawEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSUlawDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSToneDetector, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVolume, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVadDtx, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSG722Enc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSG722Dec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSFileRec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSFilePlayer, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSL16Enc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSL16Dec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSGenericPLC, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSAudioFlowControl, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSEqualizer, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSDtmfGen, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSChannelAdapter, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSAudioMixer, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSAlawEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSAlawDec, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSMJpegEnc, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVoidSink, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSVoidSource, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSTee, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSJoin, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSItcSink, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: desc->name = MSItcSource, filter_name = MSQOGL
TEE: ms_factory_lookup_filter_by_name: not found MSQOGL
Comment 2 Felix Palmen freebsd_committer freebsd_triage 2022-08-24 09:03:34 UTC
This indeed looks like it is happening in mediastreamer, so let's add bofh here :) (Any ideas?)
Comment 3 Felix Palmen freebsd_committer freebsd_triage 2022-08-24 09:07:33 UTC
Created attachment 236088 [details]
Update linphone libs

The linphone libs see new releases with bugfixes quite often, so a first test could be to try the latest versions.

Attached patch updates net/ortp, net/mediastreamer and net/liblinphone. It doesn't bump any revisions, so to test, please apply it to your ports tree, then rebuild and reinstall in this order:

net/ortp
net/mediastreamer
net/liblinphone
net/linphone

(It might make sense to do these updates even if they don't fix your current issue...)
Comment 4 Ruslan Zalata 2022-08-24 11:51:04 UTC
Thank you Felix. 

I just tested this patch (update), none of the issues I discovered had any treatment. ms_filter_link() still misses sanity checks and makes Linphone to crash when camera preview is openned. Though, they seem added checks into ms_filter_call_method() as there are some NULL ptr reports now. Here's what I get in the log:

rz@butterfly:~ % pkg info ortp
ortp-5.1.55
Name           : ortp
Version        : 5.1.55
Installed on   : Wed Aug 24 16:32:32 2022 +05
Origin         : net/ortp

rz@butterfly:~ % pkg info liblinphone
liblinphone-5.1.56
Name           : liblinphone
Version        : 5.1.56
Installed on   : Wed Aug 24 16:37:16 2022 +05
Origin         : net/liblinphone

rz@butterfly:~ % pkg info mediastreamer
mediastreamer-5.1.55
Name           : mediastreamer
Version        : 5.1.55
Installed on   : Wed Aug 24 16:36:21 2022 +05
Origin         : net/mediastreamer


[16:40:29:131][Info]Core:linphone: Webcam V4L2: /dev/video0 added
[16:40:29:142][Info]Core:linphone: [MSV4l2] Ignored /dev/video1, not a capture device.
[16:40:29:154][Info]Core:linphone: Webcam StaticImage: Static picture added
[16:40:32:494][Info]Core:linphone: Setting video size 1280x720 on stream [0x82e255700]
[16:40:32:494][Info]Core:linphone: [MSV4l2] init
[16:40:32:494][Warning]Core:linphone: [MSV4l2] set_device_orientation was called while env MS2_USE_ROTATION is not set.
[16:40:32:494][Info]Core:linphone: [MSV4l2] setsize
[16:40:32:494][Info]Core:linphone: [MSV4l2] setfps
[16:40:32:494][Info]Core:linphone: [MSV4l2] check_configured
[16:40:32:494][Info]Core:linphone: [MSV4l2] configuring
[16:40:32:494][Info]Core:linphone: [MSV4l2] Driver is uvcvideo, version is 332032
[16:40:32:495][Info]Core:linphone: [MSV4l2] format MS_MJPEG : max_fps=30, native=1, compressed=1
[16:40:32:495][Info]Core:linphone: [MSV4l2] format MS_YUYV : max_fps=10, native=1, compressed=0
[16:40:32:495][Info]Core:linphone: [MSV4l2] Candidate: 2
[16:40:32:502][Info]Core:linphone: [MSV4l2] selected format is MS_MJPEG
[16:40:32:502][Info]Core:linphone: [MSV4l2] Size of webcam delivered pictures is 1280x720. Format:0x00000005 (MS_MJPEG)
[16:40:32:502][Info]Core:linphone: [MSV4l2] check_configured
[16:40:32:502][Warning]Core:linphone: [_ms_filter_call_method] Ignoring call to filter method as the provided filter is NULL
[16:40:32:502][Warning]Core:linphone: [_ms_filter_call_method] Ignoring call to filter method as the provided filter is NULL
[16:40:32:502][Warning]Core:linphone: [_ms_filter_call_method] Ignoring call to filter method as the provided filter is NULL
[16:40:32:502][Info]Core:linphone: ms_filter_link: MSV4L2Capture:0x82e263a60,0-->MSMJpegDec:0x82e263ac0,0
[16:40:32:502][Info]Core:linphone: ms_filter_link: MSMJpegDec:0x82e263ac0,0-->MSTee:0x82e263b80,0
Comment 5 Ruslan Zalata 2022-08-24 11:53:33 UTC
BTW, there's also an issue with bogus Linphone window and font sizes that make it kind of impossible to control. I do not khow how to make a proper report of this issue. Should I upload screenshots ?
Comment 6 Felix Palmen freebsd_committer freebsd_triage 2022-08-24 11:57:06 UTC
(In reply to Ruslan Zalata from comment #4)
> Thank you Felix.
Thank you for testing so quickly! I think I'll still try to get these updates in the tree as they won't hurt...

For the actual issue, it would probably be best to report it upstream :o

Meanwhile:

> ms_filter_link() still misses sanity checks
As you did that much debugging already, do you think you might be able to come up with a patch that works around the issue? That would be *very* helpful to fix it locally in the port.

Please generate patches with either git-diff or git-format-patch. If you're not using git and generate patches manually with diff, please use the -u flag. This makes it much easier to apply them :)
Comment 7 Felix Palmen freebsd_committer freebsd_triage 2022-08-24 11:58:54 UTC
(In reply to Ruslan Zalata from comment #5)
Problem with this is: I can't reproduce it. Sure, you could upload a screenshot, but I'd still not have any idea what to do about it. It renders perfectly fine on my desktop machine (13.1-RELEASE, amd64).

Anyways, it would probably be yet another PR as it seems to be a different issue.
Comment 8 Ruslan Zalata 2022-08-24 12:48:08 UTC
Ok, I will try to produce a patch for the issues I discover. I think I can afford to spend some more time to find out why wrong "displayname" is used for linking camera preview on my system. I used Linphone mostly as a tool for debugging our SIP hardware and I miss it very much now. :)
Comment 9 Ruslan Zalata 2022-08-24 23:29:04 UTC
Created attachment 236102 [details]
Enable MSQGL filter pluging (MS Qt OpenGL) to allow camera preview to work
Comment 10 Ruslan Zalata 2022-08-25 00:12:15 UTC
Here's a description of the problem and a solution the above patch provides.

Since recent, Linphone uses new MSQOGL filter to capture and display video simultaneously. Previously they used MSOGL and that's what recommended for Linux and Windows platforms in source code of mediastreamer. For some reason Linphone developers switched to MSQOGL and hardcoded it:

linphone-app/src/components/core/CoreManager.cpp:	mCore->setVideoDisplayFilter("MSQOGL");

The above overrides display_name in linphonerc, so user has no means to choose. Changing it to "MSOGL" in the source code does not work either. Doing so makes Linphone to crash somewhere deep inside Qt5 guts.

It appears that this new "MSQOGL" filter works OK on FreeBSD too, the only thing that is needed is to enable it using -DENABLE_QT_GL=YES in mediastreamer Makefile and also to add resulting lib/mediastreamer/plugins/libmsqogl.so to package list to get it installed.

This is Qt5 EGL based plugin which should be placed in MSPLIGINS_DIR set by Linphone application itself, namely to /usr/local/lib/mediastreamer/plugins/.

The bad thing is that Linphone now fully depends on EGL. If you do not have it, you won't be able to make video calls, which is ridiculous! I personally consider this as a very bad trend.

To make sure plugin is loaded, use Linphone -V. Key lines in the log are:

[04:14:58:220][Info]Core:linphone: Loading ms plugins from [/usr/local/lib/mediastreamer/plugins]
[04:14:58:220][Info]Core:linphone: Loading plugin /usr/local/lib/mediastreamer/plugins/libmsopenh264.so...
[04:14:58:220][Info]Core:linphone: msopenh264-1.2.1 plugin registered.
[04:14:58:220][Info]Core:linphone: Plugin loaded (libmsopenh264.so)
[04:14:58:220][Info]Core:linphone: Loading plugin /usr/local/lib/mediastreamer/plugins/libmsqogl.so...
[04:14:58:220][Info]Core:linphone: libmsqogl debug plugin loaded
[04:14:58:220][Info]Core:linphone: Plugin loaded (libmsqogl.so)

[04:15:06:695][0x82b288d40][Info]"[MSQOGL] Create new Renderer"
[04:15:06:695][Info]Core:linphone: QT: "[MSQOGL] Create new Renderer"
[04:15:06:695][0x82b288d40][Info]"[MSQOGL] Update renderer to " 0x82bba2890
[04:15:06:695][Info]Core:linphone: QT: "[MSQOGL] Update renderer to " 0x82bba2890
[04:15:06:695][Error]Core:linphone: no such method on filter MSV4L2Capture, fid=16387 method index=4
[04:15:06:695][Info]Core:linphone: [ogl_display] uninit opengles_display (gl initialized:0)

[04:15:06:698][Info]Core:linphone: [ogl_display] init opengles_display (1180 x 726, gl initialized:0)
[04:15:06:698][Info]Core:linphone: OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.3.8
[04:15:06:699][Info]Core:linphone: OpenGL vendor: AMD
[04:15:06:699][Info]Core:linphone: OpenGL renderer: AMD RENOIR (DRM 3.40.0, 13.1-RELEASE-p1, LLVM 13.0.1)
[04:15:06:699][Info]Core:linphone: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.3.8
[04:15:06:699][Info]Core:linphone: OpenGL GLSL version: 4.60
[04:15:06:699][Info]Core:linphone: [ogl_display] resize opengles_display (1180 x 726, gl initialized:0)
[04:15:06:701][Info]Core:linphone: [ogl_display] OpenGL program info: [NO INFORMATION]
[04:15:06:780][Info]Core:linphone: [MSV4l2] video capture started.
[swscaler @ 0x82e81b400] deprecated pixel format used, make sure you did set range correctly
[04:15:06:941][Info]Core:linphone: [ogl_display] allocate_gl_textures: allocated new textures[0] (2048 x 1024)
Comment 11 Ruslan Zalata 2022-08-25 01:41:57 UTC
Created attachment 236103 [details]
Add sanity checks to mediastreamer msfilter.c

If mediastreamer fails to load libmsqogl.so plugin, which provides "MSQOGL" display filter, Linphone will proceed using NULL pointer in display_name variable resulting in crashes through all the places. After adding the above sanity checks Linphone stops crashing showing empty video screens and reporting NULL pointers in the log, which can help resolve further issues.
Comment 12 Felix Palmen freebsd_committer freebsd_triage 2022-08-25 08:10:55 UTC
Thanks a lot, great analytics work!

I added a proper (enabled-by-default) option and dependencies to net/mediastreamer over in PR 266017 (now linked here).

As for your second patch, I didn't add it because people won't be affected by this problem once the Qt OpenGL plugin is built and installed. Still, as it fixes a crash, you might want to propose it upstream.
Comment 13 commit-hook freebsd_committer freebsd_triage 2022-08-28 20:20:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ee2f3bc6d1742f10b26a71f6141ebbc0eae40a09

commit ee2f3bc6d1742f10b26a71f6141ebbc0eae40a09
Author:     Felix Palmen <zirias@FreeBSD.org>
AuthorDate: 2022-08-24 09:13:52 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-08-28 20:18:54 +0000

    net/mediastreamer: Update to 5.1.55

    Add QTGL option and enable it by default, this is needed by net/linphone
    for working video calls.

    Changelog: https://gitlab.linphone.org/BC/public/mediastreamer2/-/tags

    PR:             266006, 266017
    Suggested by:   Ruslan Zalata <rz@fabmicro.ru>

 net/mediastreamer/Makefile  | 15 ++++++++++-----
 net/mediastreamer/distinfo  |  6 +++---
 net/mediastreamer/pkg-plist |  1 +
 3 files changed, 14 insertions(+), 8 deletions(-)
Comment 14 commit-hook freebsd_committer freebsd_triage 2022-09-05 16:37:25 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bc333785c4dbe2d42d47c51656cf15b3db2d53bc

commit bc333785c4dbe2d42d47c51656cf15b3db2d53bc
Author:     Felix Palmen <zirias@FreeBSD.org>
AuthorDate: 2022-08-24 09:13:52 +0000
Commit:     Felix Palmen <zirias@FreeBSD.org>
CommitDate: 2022-09-05 16:36:20 +0000

    net/mediastreamer: Update to 5.1.55

    Add QTGL option and enable it by default, this is needed by net/linphone
    for working video calls.

    Changelog: https://gitlab.linphone.org/BC/public/mediastreamer2/-/tags

    PR:                     266006, 266017
    Approved by:            bofh (maintainer, via IRC), tcberner (mentor)
    Suggested by:           Ruslan Zalata <rz@fabmicro.ru>
    Differential Revision:  https://reviews.freebsd.org/D36458

 net/mediastreamer/Makefile  | 15 ++++++++++-----
 net/mediastreamer/distinfo  |  6 +++---
 net/mediastreamer/pkg-plist |  1 +
 3 files changed, 14 insertions(+), 8 deletions(-)
Comment 15 Felix Palmen freebsd_committer freebsd_triage 2022-09-05 16:53:06 UTC
Fixed by adding the missing plugin, thanks.