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

QAudioOutput crashes app when its constructor is called

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1: Critical P1: Critical
    • 6.2
    • 6.2.0
    • Multimedia
    • None
    • Windows

      I am using Qt6.2.0 and when instantiating the QAudioOuput object my app crashes 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 muted 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.

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

            anrocha André De La Rocha (Inactive)
            hbatalha Helder Batalha
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes