Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-113742

Camera/VideoOuput possible memory leak on Android.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.7.0 FF
    • 6.4.3, 6.5.0
    • Multimedia
    • None
    • Tested on Samsung Galaxy Tab S5e with arm64-v8a & armeabi-v7a.
    • Android
    • 7d53ccf26 (dev)
    • 2023wk30FOQtforAndroid, 2023wk32FOQtforAndroid, 2023wk36FOQtforAndroid

    Description

      By using in qml a CaptureSession, every time we change the Camera active property, whether by start/stop methods or by changing directly the property, the memory usage is not totally freed. This causes a crash after a certain number of iterations.

      It seems to come from the VideoOutput. When no VideoOutput is bound to the CaptureSession, the memory remains stable.

      Here is a qml code to test it out: 

       

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Window
      import QtMultimedia
      Window {
          width: 640
          height: 480
          visible: true
          property int timerEntry: 0
          CaptureSession
          {
              id: captureSessionId
              camera: Camera
              {
                  id: cameraId
                  onErrorOccurred: function(error, message) {
                      console.log("Error occurred", error, message);
                  }
              }
              videoOutput: videoOutputId // Commenting this line stabilise the memory usage
      
          }
          VideoOutput {
              id: videoOutputId
              anchors.fill: parent
              Button
              {
                  id: startButtonId
                  anchors.bottom: parent.bottom
                  anchors.horizontalCenter: parent.horizontalCenter
                  width: 50
                  height: width
                  onPressed:
                  {
                      cameraId.start()
                      timerId.start()
                  }
              }
          }
          Timer
          {
              id: timerId
              repeat: true
              interval: 2000
              onTriggered:
              {
                  timerEntry += 1
                  console.log("Timer Entry", timerEntry)
                  if(cameraId.active)
                  {
                      console.log("Stopping camera")
                      cameraId.stop()
                  }
                  else
                  {
                      console.log("Starting camera")
                      cameraId.start()
                  }
                  console.log("Timer Exit")
              }
          }
      }
      

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              bartlomiejmoskal Bartlomiej Moskal
              gino_qta Gino Biddau
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes