Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ASSERT: “m_surface” when playing video
Forum Update on Monday, May 27th 2025

ASSERT: “m_surface” when playing video

Scheduled Pinned Locked Moved General and Desktop
15 Posts 2 Posters 3.6k Views
  • 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.
  • M Offline
    M Offline
    matuQt
    wrote on last edited by
    #1

    Hi,

    I am having a problem when trying to display a video in a QGraphicsview on Windows. I am constantly getting an assert in debug

    Program: c:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin\Qt5Cored.dll
    Module: 5.3.2
    File: global\qglobal.cpp
    Line: 2127

    ASSERT: “m_surface” in file player\mfvideorenderercontrol.cpp, line 2349

    Which I can ignore and it will work, however in release mode, it crashes instead.

    Is there some call that I should be making prior to ensure that m_surface is never null by the time it hits this line?
    more informations:
    Os: windows 8.1 64 bit

    this is snip of my code
    @ QGraphicsScene *scene;
    QMediaPlayer mp;
    QGraphicsVideoItem v;
    scene = new QGraphicsScene;
    ui->graphicsView->setScene(scene);
    QStringList list;
    list <<QString("D:/files/3240/mov/1.mov") << QString("D:/files/3240/videos/newmov/1.mov")<<
    QString("D:/files/3240/videos/3.mov")<< QString("D:/files/3240/videos/4.mov")
    <<QString("D:/files/3240/videos/5.mov");
    mp.setVideoOutput(&v);
    mp.setMedia(QUrl::fromLocalFile(list.at(i%5)));
    mp.play();
    mp.setVolume(0);
    scene->addItem(&v);@

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

      Hi,

      Where's that code called from ?

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        matuQt
        wrote on last edited by
        #3

        in the Button click event

        1 Reply Last reply
        0
        • M Offline
          M Offline
          matuQt
          wrote on last edited by
          #4

          this is my code
          @#include "mainwindow.h"
          #include "ui_mainwindow.h"
          #include <QDebug>

          MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);
          i = 0;
          scene = new QGraphicsScene;
          ui->graphicsView->setScene(scene);
          // setWindowFlags(Qt::FramelessWindowHint);
          }

          MainWindow::~MainWindow()
          {
          delete ui;
          }

          void MainWindow::resizeEvent(QResizeEvent *)
          {

          }

          void MainWindow::mousePressEvent(QMouseEvent *)
          {

          }

          void MainWindow::on_pushButton_clicked()
          {
          resize(1080,400);
          QStringList list;
          list <<QString("D:/files/3240/mov/1.mov") << QString("D:/files/3240/videos/newmov/1.mov")<<
          QString("D:/files/3240/videos/3.mov")<< QString("D:/files/3240/videos/4.mov")
          <<QString("D:/files/3240/videos/5.mov");
          mp.setVideoOutput(&v);
          mp.setMedia(QUrl::fromLocalFile(list.at(i%5)));
          mp.play();
          mp.setVolume(0);
          scene->addItem(&v);
          //v->setSize(QSize(width(),height()));
          i++;
          }
          @

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

            What is w ?

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

            1 Reply Last reply
            0
            • M Offline
              M Offline
              matuQt
              wrote on last edited by
              #6

              w? didn't exist any w in this code. but if your mean is v.
              v is QGraphicsVideoItem and mp is QMediaPlayer

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

                What happens if you start playing only after adding v to the scene ?

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

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  matuQt
                  wrote on last edited by
                  #8

                  at this time it show me the mention assert error

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

                    Since Qt 5.4 has been released, can you check if you still encounter this problem ?

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

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      matuQt
                      wrote on last edited by
                      #10

                      yes , i don't have any idea to solve it

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

                        Yes you will test or yes you still have this problem ?

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

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          matuQt
                          wrote on last edited by
                          #12

                          both, i tested Qt5.4 and the error exist in Qt 5.4

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

                            Where's the assert located this time ?

                            Did you install the latest driver for your graphic card ?

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

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              matuQt
                              wrote on last edited by
                              #14

                              i update my graphic card again and the assert error does exist yet :( . what should i do to solve it?

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

                                @
                                mp.setVideoOutput(&v);
                                scene->addItem(&v);
                                @

                                I'd move that in the constructor, there's no need to do that again each time.

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

                                1 Reply Last reply
                                0

                                • Login

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