Bug 437328

Summary: digiKam crashes when a playback of video is started
Product: [Applications] digikam Reporter: Jozef Říha <jose1711>
Component: Preview-VideoAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.2.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 8.3.0
Sentry Crash Report:

Description Jozef Říha 2021-05-18 23:03:38 UTC
SUMMARY
I've recently added ~600MB video to my collection. After starting playback digiKam crashes.

STEPS TO REPRODUCE
1. Locate the video file and double-click it

OBSERVED RESULT
digiKam window disappears and the following is displayed in the terminal:
corrupted size vs. prev_size
[1]    49857 abort (core dumped)  /usr/bin/digikam

EXPECTED RESULT
Video plays fine

SOFTWARE/OS VERSIONS
Linux: Arch Linux rolling x86_64
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Other video (different format) play fine. Output of mediainfo:

General
Complete name                            : affected_file.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp41/isom)
File size                                : 652 MiB
Duration                                 : 17 min 48 s
Overall bit rate                         : 5 121 kb/s
Encoded date                             : UTC 2021-05-17 14:45:28
Tagged date                              : UTC 2021-05-17 14:45:28

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L3.1
Format settings                          : 2 Ref Frames
Format settings, CABAC                   : No
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=1, N=60
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 17 min 48 s
Bit rate                                 : 4 940 kb/s
Width                                    : 854 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 29.970 (30000/1001) FPS
Minimum frame rate                       : 29.970 FPS
Maximum frame rate                       : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.402
Stream size                              : 629 MiB (96%)
Encoded date                             : UTC 2021-05-17 14:45:28
Tagged date                              : UTC 2021-05-17 14:45:28
mdhd_Duration                            : 1068234
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 17 min 48 s
Bit rate mode                            : Constant
Bit rate                                 : 178 kb/s
Nominal bit rate                         : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 22.6 MiB (3%)
Encoded date                             : UTC 2021-05-17 14:45:28
Tagged date                              : UTC 2021-05-17 14:45:28
mdhd_Duration                            : 1068245
Comment 1 Maik Qualmann 2021-05-19 05:48:34 UTC
Without the video file or a backtrace, we will not be able to help. All of my MP4 files play with no problem.

Maik
Comment 2 Maik Qualmann 2021-05-19 11:31:05 UTC
Thanks for the link to the video download. I cannot reproduce the problem with my native Linux development version, not even with the AppImage or with the current Windows version. Do you use native Arch packages? If so, please test with the AppImage. Otherwise, you have to create a backtrace, as described here (https://www.digikam.org/contribute/), so that we can find out more about what could be the cause for you.

First you had "Kodi" in the subject line. Does the problem also occur with other players based on FFmpeg?

Maik
Comment 3 Maik Qualmann 2021-05-19 11:45:43 UTC
I'm linking bug 435660 because both users are using Arch Linux. Both bugs may be related.

Maik
Comment 4 Maik Qualmann 2021-05-19 11:56:40 UTC
Could actually be a deeper problem in Arch Linux. 

https://bugs.archlinux.org/task/70374

Maik
Comment 5 Jozef Říha 2021-05-19 17:06:14 UTC
The video file plays fine in a web-browser or (after download) in mpv, totem, vlc, mplayer, ffplay. Sorry about kodi - I was just thinking about another thing while reporting (my mind was not fully focused).

Tried AppImage version - got no crash but the video playback is really slow and sound is choppy. This may however be another problem though as I am getting this for other videos as well (those that work with the native Arch Linux version fine).

Still interested in collecting the trace or this is a wrong place for bug report since it seems to be Arch-specific?
Comment 6 Maik Qualmann 2021-05-20 06:35:58 UTC
Without a GDB backtrace of the crash, there is no way of knowing what the possible cause is.

Maik
Comment 7 Jozef Říha 2021-05-20 12:26:51 UTC
corrupted size vs. prev_size
--Type <RET> for more, q to quit, c to continue without paging--

Thread 1 "digikam" received signal SIGSEGV, Segmentation fault.
0x00007ffff5cc92fa in QRegion::intersected(QRect const&) const () from /usr/lib/libQt5Gui.so.5
(gdb) bt
#0  0x00007ffff5cc92fa in QRegion::intersected(QRect const&) const () at /usr/lib/libQt5Gui.so.5
#1  0x00007ffff5cc94bf in QRegion::operator&(QRect const&) const () at /usr/lib/libQt5Gui.so.5
#2  0x00007ffff60d3fe3 in QWidget::update(QRegion const&) () at /usr/lib/libQt5Widgets.so.5
#3  0x00007ffff60eaab1 in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#4  0x00007ffff60a6d62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#5  0x00007ffff55d300a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#6  0x00007ffff55d6109 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#7  0x00007ffff562c604 in  () at /usr/lib/libQt5Core.so.5
#8  0x00007fffe463302c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#9  0x00007fffe4686b59 in  () at /usr/lib/libglib-2.0.so.0
#10 0x00007fffe4630781 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#11 0x00007ffff562bc36 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#12 0x00007ffff55d197c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff7a1b78a in Digikam::ScanController::completeCollectionScanCore(bool, bool) () at /usr/lib/libdigikamgui.so.7.2.0
#14 0x00007ffff7bac979 in Digikam::NewItemsFinder::slotStart() () at /usr/lib/libdigikamgui.so.7.2.0
#15 0x00007ffff560015f in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#16 0x00007ffff60a6d62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#17 0x00007ffff55d300a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#18 0x00007ffff55d6109 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#19 0x00007ffff562c604 in  () at /usr/lib/libQt5Core.so.5
#20 0x00007fffe463302c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#21 0x00007fffe4686b59 in  () at /usr/lib/libglib-2.0.so.0
#22 0x00007fffe4630781 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#23 0x00007ffff562bc36 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff55d197c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff55d9ee4 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#26 0x00005555555598be in main ()
(gdb)
Comment 8 Maik Qualmann 2021-05-20 15:44:29 UTC
Ok, the crash in QRegion is deep in Qt. The crash log is almost identical to bug 435660. I close here as a duplicate. Is there a special feature in Arch Linux, which desktop theme is used?

Maik

*** This bug has been marked as a duplicate of bug 435660 ***
Comment 9 Jozef Říha 2021-05-20 22:01:23 UTC
I don't think I am using anything exotic. Just a standard Gnome with Adwaita theme. Qt theme I believe defaults to GTK+ to provide an unified look of the apps.
Comment 10 caulier.gilles 2022-05-12 11:25:19 UTC
Git commit 5aae9b7c21ab662d63b49f165163984809c1d585 by Gilles Caulier.
Committed on 12/05/2022 at 11:10.
Pushed by cgilles into branch 'master'.

Move AVPlayer config widgets to core/QtAV to allow to re-use these settings view in a new Video section from digiKam Setup dialog.
the goal is to be able to configure the video decoder, the audio backend, and the video renderer with video preview framework,
to prevent dysfunctions while playing audio and video media if wrong decoder/backend/renderer is selected by default.

Currently none of these settings is possible in digiKam and playing video and audio always depends of default settings done in QtAV
framework which can be badly configured for the available hardwares and modules in client computer.

TODO: add the new video config pannel in digiKam Setup dialog to configure decoder/backend/renderer.
Related: bug 435660, bug 382582, bug 445422, bug 426951, bug 430873, bug 388475, bug 440668, bug 415778, bug 442802, bug 423580

M  +2    -14   core/avplayer/CMakeLists.txt
M  +3    -6    core/avplayer/main/MainWindow.cpp
M  +7    -7    core/avplayer/main/MainWindow.h
R  +2    -0    core/avplayer/utils/ConfigDialog.cpp [from: core/avplayer/config/ConfigDialog.cpp - 099% similarity]
R  +8    -5    core/avplayer/utils/ConfigDialog.h [from: core/avplayer/config/ConfigDialog.h - 090% similarity]
M  +2    -0    core/avplayer/utils/common.cpp
M  +12   -0    core/libs/video/qtav/CMakeLists.txt
R  +2    -2    core/libs/video/qtav/widgets/config/AVFilterConfigPage.cpp [from: core/avplayer/config/AVFilterConfigPage.cpp - 098% similarity]
R  +7    -6    core/libs/video/qtav/widgets/config/AVFilterConfigPage.h [from: core/avplayer/config/AVFilterConfigPage.h - 086% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/AVFormatConfigPage.cpp [from: core/avplayer/config/AVFormatConfigPage.cpp - 098% similarity]
R  +7    -6    core/libs/video/qtav/widgets/config/AVFormatConfigPage.h [from: core/avplayer/config/AVFormatConfigPage.h - 084% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/AVPlayerConfigMngr.cpp [from: core/avplayer/config/AVPlayerConfigMngr.cpp - 099% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/AVPlayerConfigMngr.h [from: core/avplayer/config/AVPlayerConfigMngr.h - 098% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/CaptureConfigPage.cpp [from: core/avplayer/config/CaptureConfigPage.cpp - 099% similarity]
R  +7    -6    core/libs/video/qtav/widgets/config/CaptureConfigPage.h [from: core/avplayer/config/CaptureConfigPage.h - 086% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/ClickableMenu.cpp [from: core/avplayer/utils/ClickableMenu.cpp - 097% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/ClickableMenu.h [from: core/avplayer/utils/ClickableMenu.h - 082% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/ConfigPageBase.cpp [from: core/avplayer/config/ConfigPageBase.cpp - 097% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/ConfigPageBase.h [from: core/avplayer/config/ConfigPageBase.h - 087% similarity]
R  +34   -37   core/libs/video/qtav/widgets/config/DecoderConfigPage.cpp [from: core/avplayer/config/DecoderConfigPage.cpp - 098% similarity]
R  +11   -6    core/libs/video/qtav/widgets/config/DecoderConfigPage.h [from: core/avplayer/config/DecoderConfigPage.h - 082% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/MiscPage.cpp [from: core/avplayer/config/MiscPage.cpp - 099% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/MiscPage.h [from: core/avplayer/config/MiscPage.h - 086% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/PropertyEditor.cpp [from: core/avplayer/config/PropertyEditor.cpp - 099% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/PropertyEditor.h [from: core/avplayer/config/PropertyEditor.h - 093% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/ShaderPage.cpp [from: core/avplayer/config/ShaderPage.cpp - 098% similarity]
R  +7    -6    core/libs/video/qtav/widgets/config/ShaderPage.h [from: core/avplayer/config/ShaderPage.h - 085% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/Slider.cpp [from: core/avplayer/utils/Slider.cpp - 099% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/Slider.h [from: core/avplayer/utils/Slider.h - 088% similarity]
R  +2    -2    core/libs/video/qtav/widgets/config/VideoEQConfigPage.cpp [from: core/avplayer/config/VideoEQConfigPage.cpp - 099% similarity]
R  +10   -6    core/libs/video/qtav/widgets/config/VideoEQConfigPage.h [from: core/avplayer/config/VideoEQConfigPage.h - 088% similarity]

https://invent.kde.org/graphics/digikam/commit/5aae9b7c21ab662d63b49f165163984809c1d585
Comment 11 caulier.gilles 2022-05-12 13:59:05 UTC
Git commit 505bc17cd39702e14446c15d79d44d14d80fe005 by Gilles Caulier.
Committed on 12/05/2022 at 13:56.
Pushed by cgilles into branch 'master'.

Add Setup Video page from digiKam configuration dialog.
This allow to setup few options for media player as the decoder priority to use.
Related: bug 435660, bug 382582, bug 445422, bug 426951, bug 430873, bug 388475, bug 440668, bug 415778, bug 442802, bug 423580

M  +24   -12   core/libs/video/player/mediaplayerview.cpp
M  +1    -0    core/libs/video/player/mediaplayerview.h
M  +22   -10   core/libs/video/player/slidevideo.cpp
M  +4    -0    core/libs/video/player/slidevideo.h
M  +2    -2    core/libs/video/qtav/widgets/config/AVPlayerConfigMngr.cpp
M  +1    -1    core/libs/video/qtav/widgets/config/DecoderConfigPage.cpp
M  +1    -0    core/utilities/setup/CMakeLists.txt
M  +29   -0    core/utilities/setup/setup.cpp
M  +2    -0    core/utilities/setup/setup.h
M  +1    -1    core/utilities/setup/setuptemplate.cpp
A  +69   -0    core/utilities/setup/setupvideo.h     [License: GPL (v2+)]

https://invent.kde.org/graphics/digikam/commit/505bc17cd39702e14446c15d79d44d14d80fe005
Comment 12 caulier.gilles 2022-05-12 15:27:23 UTC
Git commit 0e2bc2695efc7d6d0d2ec52731c3f69095554b7f by Gilles Caulier.
Committed on 12/05/2022 at 15:24.
Pushed by cgilles into branch 'master'.

Hide advanced settings for each decoder as nothing is saved and restored between the sessions. Only the list of decoder and the priority is saved
Related: bug 435660, bug 382582, bug 445422, bug 426951, bug 430873, bug 388475, bug 440668, bug 415778, bug 442802, bug 423580

M  +6    -4    core/libs/video/qtav/widgets/config/DecoderConfigPage.cpp
M  +1    -1    core/libs/video/qtav/widgets/config/DecoderConfigPage.h
M  +1    -1    core/utilities/setup/setupvideo.cpp

https://invent.kde.org/graphics/digikam/commit/0e2bc2695efc7d6d0d2ec52731c3f69095554b7f
Comment 13 caulier.gilles 2024-01-26 12:48:49 UTC
fixed with bug 435660