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] 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]] - [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. 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 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. - [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: ** WAIT Make toolbar functional for =songeditor= [3/4] [75%] :core:
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]]

View file

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

View file

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

View file

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