summary refs log tree commit diff
path: root/gnu/packages/patches/jami-memory-usage.patch
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-27 10:27:14 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-27 10:51:54 -0500
commit95a74533f12a2636caafc93f24a8058adc8d27c9 (patch)
tree81de286849b6749729d36b043c0484ab9c7cc576 /gnu/packages/patches/jami-memory-usage.patch
parent649a4e9c9c0f6f03f5c7529f2373bb8d550f6e32 (diff)
downloadguix-95a74533f12a2636caafc93f24a8058adc8d27c9.tar.gz
gnu: jami: Reduce memory consumption in conversation view.
This fixes <https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/649>.

* gnu/packages/patches/jami-images-loading.patch: New patch.
* gnu/packages/patches/jami-memory-usage.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Register them.
* gnu/packages/jami.scm (jami)[source]: Apply them.
Diffstat (limited to 'gnu/packages/patches/jami-memory-usage.patch')
-rw-r--r--gnu/packages/patches/jami-memory-usage.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/gnu/packages/patches/jami-memory-usage.patch b/gnu/packages/patches/jami-memory-usage.patch
new file mode 100644
index 0000000000..75fcde8d0a
--- /dev/null
+++ b/gnu/packages/patches/jami-memory-usage.patch
@@ -0,0 +1,70 @@
+From e796b3325d95b5ddd6162b5513c8325210f41fc5 Mon Sep 17 00:00:00 2001
+From: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
+Date: Wed, 26 Jan 2022 11:37:07 -0500
+Subject: [PATCH] datatransferimage: improve memory usage
+
++ Reduce listview caching' size by 50%
++ use sourceSize to compress images and speedup loading
++ use autoTransform: true to rotate images when needed
+
+Change-Id: Idf1babdc73f43aa6a79b89428c25c5d06856c0ef
+GitLab: #649
+---
+
+diff --git a/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml b/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml
+index d017c03..ca5913e 100644
+--- a/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml
++++ b/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml
+@@ -255,9 +255,13 @@
+                     asynchronous: true
+                     width: sourceComponent.width
+                     height: sourceComponent.height
+-                    sourceComponent: mediaInfo.isImage !== undefined ?
+-                                         imageComp : mediaInfo.isAnimatedImage !== undefined ? animatedImageComp :
+-                                         avComp
++                    sourceComponent: {
++                        if (mediaInfo.isImage)
++                            return imageComp
++                        if (mediaInfo.isAnimatedImage)
++                            return animatedImageComp
++                        return avComp
++                    }
+                     Component {
+                         id: avComp
+                         WebEngineView {
+@@ -316,7 +320,7 @@
+                             fillMode: Image.PreserveAspectCrop
+                             mipmap: true
+                             antialiasing: true
+-                            autoTransform: false
++                            autoTransform: true
+                             asynchronous: true
+                             source: "file:///" + Body
+                             property real aspectRatio: implicitWidth / implicitHeight
+@@ -361,8 +365,10 @@
+                             fillMode: Image.PreserveAspectCrop
+                             mipmap: true
+                             antialiasing: true
+-                            autoTransform: false
++                            autoTransform: true
+                             asynchronous: true
++                            sourceSize.width: width
++                            sourceSize.height: height
+                             source: "file:///" + Body
+                             property real aspectRatio: implicitWidth / implicitHeight
+                             property real adjustedWidth: Math.min(maxSize,
+diff --git a/client-qt/src/mainview/components/MessageListView.qml b/client-qt/src/mainview/components/MessageListView.qml
+index 2b7c326..f65e67b 100644
+--- a/client-qt/src/mainview/components/MessageListView.qml
++++ b/client-qt/src/mainview/components/MessageListView.qml
+@@ -174,8 +174,8 @@
+     width: parent.width
+     // this offscreen caching is pretty huge
+     // displayMarginEnd may be removed
+-    displayMarginBeginning: 4096
+-    displayMarginEnd: 4096
++    displayMarginBeginning: 2048
++    displayMarginEnd: 2048
+     maximumFlickVelocity: 2048
+     verticalLayoutDirection: ListView.BottomToTop
+     boundsBehavior: Flickable.StopAtBounds