Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. QAudioOutput seems to crash my app - Qt6 QMediaPlayer/multimedia Problems
Forum Updated to NodeBB v4.3 + New Features

QAudioOutput seems to crash my app - Qt6 QMediaPlayer/multimedia Problems

Scheduled Pinned Locked Moved Solved Qt 6
18 Posts 3 Posters 3.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hbatalha
    wrote on last edited by hbatalha
    #1

    I am trying to learn multimedia programming in Qt and to start off I am trying to set up a very basic video player.
    But this seems to be a challenge now in Qt6 due to major changes made in multimedia module.
    While in Qt5 QMediaPlayer had the control over the volume, that has changed and now this is the job of the QAudioOutput and it has to be set by QMediaPlayer.
    In this article it is explained the reason for this change and more others. Even though it is claimed that it is simplifying things, I am yet to see it. As of matter of fact I noticed that there are thing that worked fined in Qt5 but not anymore in Qt6, I am guessing this is normal when major releases are made.

    Anyway, I am using Qt6.2.0 and when instantiating the QAudioOuput object my app crahes and doesn't even start, seems to be some code in the constructor that it is causing it.

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
        videoWidget = new QVideoWidget(this);
        videoWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
        videoWidget->setMinimumHeight(0);
    
    //    audioOutput = new QAudioOutput(this);
        mediaPlayer = new QMediaPlayer(this);
        mediaPlayer->setVideoOutput(videoWidget);
        mediaPlayer->setSource(QUrl::fromLocalFile("D:\\Videos\\Videos\\New\\Michael J - Bad.mp4"));
    //    mediaPlayer->setAudioOutput(audioOutput);
    
        ui->stackedWidget->addWidget(videoWidget);
        ui->stackedWidget->setCurrentWidget(videoWidget);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        mediaPlayer->play();
    }
    

    If I uncomment audioOutput = new QAudioOutput(this); the app crashes before even starting.
    QAudioOutput is only for the audio which means that without it the video will be mute but still play supposedly which doesn't happen still. If I click the button nothing happens while if I switch to Qt5 it works fine.

    I don't know if I am doing everything correctly according to Qt6 though. But the doc is still very incomplete as it can be seen here (there are some methods without documentation and needs to be update as it still uses the default example for Qt5 because here it is using the setVolume with the QMediaPlayer, that in Qt6 is not present anymore). It's seems that there's a lot work yet to be done.

    In the meantime, I am planning to build a full working video player so I can implement some features for personal use. But I am guessing that this is not possible for the time being with Qt 6 and I am very but VERY reluctant to use Qt5 for the simple feeling that I might be moving backwards and also I want my apps to accompany the Qt development as it moves forward.

    Thoughts?

    Edit:
    I forgot to mention the platform, I am on Windows 10 21H1

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you already check the bug report system ?

      Are you using the latest beta available ?

      On which platform are you getting that issue ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      H 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Did you already check the bug report system ?

        Are you using the latest beta available ?

        On which platform are you getting that issue ?

        H Offline
        H Offline
        hbatalha
        wrote on last edited by
        #3

        @SGaist said in QAudioOutput seems to crash my app - Qt6 QMediaPlayer/multimedia Problems:

        Did you already check the bug report system ?

        Yes, but didn't find anything. I want to write a bug report but I am looking for a feedback here to see if it's a really a bug or maybe I doing something wrong

        Are you using the latest beta available ?

        Yes.

        On which platform are you getting that issue ?

        Sorry I forgot to mention that in the OP, I am on Windows 10.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If just creating a QAudioOutput crashes your application then there's something wrong going on.

          What is the stack trace of the crash ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          H 1 Reply Last reply
          0
          • SGaistS SGaist

            If just creating a QAudioOutput crashes your application then there's something wrong going on.

            What is the stack trace of the crash ?

            H Offline
            H Offline
            hbatalha
            wrote on last edited by hbatalha
            #5

            @SGaist Segmentation fault.
            Screenshot_2.png

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Please use a debug build to get a proper stack trace.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              H 1 Reply Last reply
              0
              • SGaistS SGaist

                Please use a debug build to get a proper stack trace.

                H Offline
                H Offline
                hbatalha
                wrote on last edited by
                #7

                @SGaist I don't understand what you meant by "debug build to get a proper stack trace". I am running the debugger in debug mode and that is the result I am getting.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  So you might be missing Qt's debug symbols as seeing the Disassembler view is unusual in a debug build.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  H 1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kleinlee
                    wrote on last edited by kleinlee
                    #9

                    I have the same question when using Qt6.2Beta. QAudioOutput worked well on MAC, while crashed on Windows.
                    5ec59c64-d029-4872-8cd1-5218f518ae6e-1629570675(1).png

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      So you might be missing Qt's debug symbols as seeing the Disassembler view is unusual in a debug build.

                      H Offline
                      H Offline
                      hbatalha
                      wrote on last edited by
                      #10

                      @SGaist Sorry for the late reply.

                      I always saw the Disassembler view since I first started using Qt so I thought that was normal.

                      What those Qt's debug symbols could be?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Did you install the debug symbols ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        H 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Did you install the debug symbols ?

                          H Offline
                          H Offline
                          hbatalha
                          wrote on last edited by
                          #12

                          @SGaist I just g searched about debug symbols and how to install but didn't find much relating to gdb on windows

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            You can download the debug symbols from the maintenance tool.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            H 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              You can download the debug symbols from the maintenance tool.

                              H Offline
                              H Offline
                              hbatalha
                              wrote on last edited by
                              #14

                              @SGaist I have downloaded everything related to debugging in the maintenance tool but nothing seems to be working.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                Ok... If memory serves well, another beta has been released, did you check it ?

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                H 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  Ok... If memory serves well, another beta has been released, did you check it ?

                                  H Offline
                                  H Offline
                                  hbatalha
                                  wrote on last edited by
                                  #16

                                  @SGaist yeah, same result. Still crashing. The bug report I made the priority was turned to P1: Critical but the status and resolution is still the same.

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    I would add a complete minimal compilable example the report. This would allow more people to help fixing that issue.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    H 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      I would add a complete minimal compilable example the report. This would allow more people to help fixing that issue.

                                      H Offline
                                      H Offline
                                      hbatalha
                                      wrote on last edited by
                                      #18

                                      @SGaist I believe the bug has been fixed: https://bugreports.qt.io/browse/QTBUG-95234

                                      1 Reply Last reply
                                      1

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved