Memory leaks in QtMultimedia 5.0 on QML element MediaPlayer and Video?
-
Hi there,
Not quite sure if this is the right place to post this question. But this is, really, really, driving me crazy... :(
I'm currently working on a project, in which, I need a simple video player component to constantly play a list of videos. Let's say, I have 8 videos, and want to switch to the next video in the list every 10 seconds.
I did the test with a very simple code (see below, only writing QML code, leaving other code files in the project as default). When I run this simple test program, it looks like it keeps eating memory without releasing it.
- on start, it uses only around 60 MB memory (observed simply via Windows Task Manager)
- 30 minutes later, the memory usage goes up to around 130 MB
- 3 hours later, this program crashes.
So the question here is, is this a bug, or am I walking the wrong way?
Environment:
Windows 7 SP1, Visual Studio 2010, Qt 5.1.0 32 bit.
Code:
(putting the Timer in QML is only for test purpose...)
(the maximum video file size is around 8MB, total size of these 8 videos is less than 24 MB)
@
import QtQuick 2.0
import QtMultimedia 5.0Rectangle {
id: window
width: 800; height:600property int videoIndex: 0 property variant videos: ["101.mp4", "102.mp4", "103.mp4", "104.mp4", "105.mp4", "106.mp4", "107.mp4", "108.mp4"] Timer { interval: 10000 // change the MediaPlayer source every 10 seconds running: true repeat: true onTriggered: { console.log("Now switching to " + videos[videoIndex]); videoPlayer.stop(); // stop the current MediaPlayer first videoPlayer.source = videos[videoIndex]; // change the MediaPlayer source videoPlayer.play(); // start play the MediaPlayer if(videoIndex < 7) { ++videoIndex; } else { videoIndex = 0; } } } Rectangle { id: bottomRect width: window.width; height: window.height MediaPlayer { id: videoPlayer source: "108.mp4" } VideoOutput { id: videoOutput source: videoPlayer width: parent.width; height: parent.height } }
}
@Additionally, I've also tried Video instead of MediaPlayer+VideoOutput. Same issue.
Any suggestion would be really appreciate.
-
I don't know this is a bug or not, but you could report the bug through this website--"bug report":https://bugreports.qt-project.org/login.jsp?permissionViolation=true&os_destination=/secure/ViewProfile.jspa
If this is a bug, maybe you could try another api, like the api of openCV, it is pretty easy to use.
-
Thank you, Robot, I've opened a bug for this.
https://bugreports.qt-project.org/browse/QTBUG-32481I'll try some api else, thanks for the tip of openCV.
If anyone else met the same issue, and happen to have a solution or workaround, please shed some light on this. Thanks in advance.
-
Hi All,
After futher investigation, i think the issue was more to do with the gstreamer1.0 VA-API plugin.
Thank you
Richard