fixing the crashes and maybe speed up loading of objects in slides

This commit is contained in:
Chris Cochrun 2022-09-07 13:32:36 -05:00
parent d5c050a333
commit e758958dca
4 changed files with 29 additions and 20 deletions

View file

@ -12,13 +12,18 @@
- [X] Initial ListView with text coming from =getLyricList=
- [X] Depending on this [[*Need to make getLyricList give back the verses with empty lines as separate slides][Need to make getLyricList give back the verses with empty lines as separate slides]]
- [ ] Need to perhaps address the MPV crashing problem for a smoother experience.
- [X] Need to perhaps address the MPV crashing problem for a smoother experience.
Essentially, mpv objects cause a seg fault when we remove them from the qml graph scene and are somehow re-referencing them. Using =reuseItems=, I can prevent the seg fault but then we are storing a lot of things in memory and will definitely cause slowdowns on older hardware. So far I haven't seen too many problems with the =reuseItems= piece yet.
Apparently, I still have crashing
Setting a really high =cacheBuffer= in the ListView seems to have fixed the crashing, but will result in higher memory use. As of right now we are using 1.1Gb total, so I may think of a better solution later, but for now, that'll have to work.
- [X] There is also a small hiccup in switching between songs. I appears as if songs that don't have any slides will have ghost slides from the previously selected song.
- [ ] Another issue I discovered was that when switching to a song with videoBackgrounds, the mpv object doesn't ALWAYS load the first frame of the slide. Can I let the video play a tiny bit longer to make sure frames ALWAYS get loaded?
** WAIT Make toolbar functional for =songeditor= [3/4] [75%] :core:
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]]

View file

@ -93,7 +93,7 @@ Item {
Timer {
id: pauseTimer
interval: 200
interval: 300
onTriggered: mpv.pause()
}

View file

@ -58,26 +58,28 @@ Item {
anchors.rightMargin: 20
model: songModel
clip: true
cacheBuffer: 900
cacheBuffer: 1900
reuseItems: true
spacing: Kirigami.Units.gridUnit
/* flickDeceleration: 4000 */
/* boundsMovement: Flickable.StopAtBounds */
synchronousDrag: true
delegate: Presenter.Slide {
id: representation
editMode: true
imageSource: root.imageBackground
videoSource: root.videoBackground
hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment
chosenFont: font
textSize: fontSize
preview: true
text: verse
implicitWidth: slideList.width
implicitHeight: width * 9 / 16
itemType: "song"
delegate: Loader {
width: slideList.width
height: width * 9 / 16
Presenter.Slide {
id: representation
editMode: true
imageSource: root.imageBackground
videoSource: root.videoBackground
hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment
chosenFont: font
textSize: fontSize
preview: true
text: verse
implicitWidth: slideList.width
implicitHeight: width * 9 / 16
itemType: "song"
}
}
Kirigami.WheelHandler {
@ -155,9 +157,10 @@ Item {
}
function loadVideo() {
showPassiveNotification("I'm loading the videos");
for (var i = 0; i < slideList.count; ++i) {
slideList.currentIndex = i;
slideList.currentItem.loadVideo();
slideList.currentItem.representation.loadVideo();
print(slideList.currentItem);
}
}

View file

@ -424,6 +424,7 @@ Item {
/* print("Here are the verses: " + verses); */
const verses = songsqlmodel.getLyricList(id);
verses.forEach(slideEditor.appendVerse);
/* slideEditor.loadVideo(); */
}
function clearSlides() {