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
Ruslan Zalata
2022-08-23 21:50:35 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 This indeed looks like it is happening in mediastreamer, so let's add bofh here :) (Any ideas?) 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...)
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 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 ? (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 :) (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. 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. :) Created attachment 236102 [details]
Enable MSQGL filter pluging (MS Qt OpenGL) to allow camera preview to work
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) 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.
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. 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(-) 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(-) Fixed by adding the missing plugin, thanks. |