Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. MediaPlayer Segfault with null defaultAudioOutput

MediaPlayer Segfault with null defaultAudioOutput

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
11 Posts 2 Posters 1.7k Views 1 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.
  • K Offline
    K Offline
    Kuzma30
    wrote on last edited by Kuzma30
    #1

    I have custom board with CM4 and MAX98357A for sound.
    Sound system - ALSA (without PulseAudio. I have problems with it)
    I use dev.xml (Qt 6.7.0) manifest in boot2qt distro.
    I have app that consist of many QML files. Its under active development. App works fine without SoundEffect. After start I can see GUI after 5 sec. Switching menu( each menu in separate file and activated by Loader in QML) - less second.

    When I add SoundEffect to my app it dramatically slow down. Loading app before GUI shown - 20 sec. Switching menu - near 5 sec.

    I use +- 20 SoundEffect, with different sound files source in my code. Is it correct practice or I must use one SoundEffect and change source var on it?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kuzma30
      wrote on last edited by Kuzma30
      #2

      I also try switch from SoundEffect to MediaPlayer but get SEGFAULTS

      MediaPlayer {
              id: lostLinkSound
              source: "qrc:/qml/Component/Sound/lost_link_"+trans.currentLanguage+".wav"
              audioOutput: AudioOutput {}
              }
      
      

      Log for error

      gdb ./Ferti 
      GNU gdb (GDB) 13.2
      Copyright (C) 2023 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      Type "show copying" and "show warranty" for details.
      This GDB was configured as "arm-poky-linux-gnueabi".
      Type "show configuration" for configuration details.
      For bug reporting instructions, please see:
      <https://www.gnu.org/software/gdb/bugs/>.
      Find the GDB manual and other documentation resources online at:
          <http://www.gnu.org/software/gdb/documentation/>.
      
      For help, type "help".
      Type "apropos word" to search for commands related to "word"...
      Reading symbols from ./Ferti...
      (gdb) r
      Starting program: /usr/lib/Ferti 
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/libthread_db.so.1".
      [New Thread 0xb2b202c0 (LWP 29448)]
      [New Thread 0xb188b2c0 (LWP 29449)]
      [Detaching after vfork from child process 29450]
      [Detaching after vfork from child process 29455]
      [New Thread 0xb0d822c0 (LWP 29456)]
      [New Thread 0xaed3a2c0 (LWP 29457)]
      
      Thread 1 "Ferti" received signal SIGSEGV, Segmentation fault.
      0xaef219b0 in gst_device_create_element () from /lib/libgstreamer-1.0.so.0
      
      K 1 Reply Last reply
      0
      • K Kuzma30

        I also try switch from SoundEffect to MediaPlayer but get SEGFAULTS

        MediaPlayer {
                id: lostLinkSound
                source: "qrc:/qml/Component/Sound/lost_link_"+trans.currentLanguage+".wav"
                audioOutput: AudioOutput {}
                }
        
        

        Log for error

        gdb ./Ferti 
        GNU gdb (GDB) 13.2
        Copyright (C) 2023 Free Software Foundation, Inc.
        License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
        This is free software: you are free to change and redistribute it.
        There is NO WARRANTY, to the extent permitted by law.
        Type "show copying" and "show warranty" for details.
        This GDB was configured as "arm-poky-linux-gnueabi".
        Type "show configuration" for configuration details.
        For bug reporting instructions, please see:
        <https://www.gnu.org/software/gdb/bugs/>.
        Find the GDB manual and other documentation resources online at:
            <http://www.gnu.org/software/gdb/documentation/>.
        
        For help, type "help".
        Type "apropos word" to search for commands related to "word"...
        Reading symbols from ./Ferti...
        (gdb) r
        Starting program: /usr/lib/Ferti 
        [Thread debugging using libthread_db enabled]
        Using host libthread_db library "/lib/libthread_db.so.1".
        [New Thread 0xb2b202c0 (LWP 29448)]
        [New Thread 0xb188b2c0 (LWP 29449)]
        [Detaching after vfork from child process 29450]
        [Detaching after vfork from child process 29455]
        [New Thread 0xb0d822c0 (LWP 29456)]
        [New Thread 0xaed3a2c0 (LWP 29457)]
        
        Thread 1 "Ferti" received signal SIGSEGV, Segmentation fault.
        0xaef219b0 in gst_device_create_element () from /lib/libgstreamer-1.0.so.0
        
        K Offline
        K Offline
        Kuzma30
        wrote on last edited by Kuzma30
        #3

        More info and tests

        root@b2qt-raspberrypi4:/usr/lib# aplay -L
        null
            Discard all samples (playback) or generate zero samples (capture)
        sysdefault:CARD=MAX98357A
            MAX98357A, bcm2835-i2s-HiFi HiFi-0
            Default Audio Device
        root@b2qt-raspberrypi4:/usr/lib# aplay -l
        **** List of PLAYBACK Hardware Devices ****
        card 0: MAX98357A [MAX98357A], device 0: bcm2835-i2s-HiFi HiFi-0 [bcm2835-i2s-HiFi HiFi-0]
          Subdevices: 1/1
          Subdevice #0: subdevice #0
        root@b2qt-raspberrypi4:/usr/lib#
        

        I add in my code.

        MediaDevices {
                    id: mediaDevices
                    Component.onCompleted: {
                        console.log("Outputs Audio devices List: " + audioOutputs)
                        console.log("Outputs Audio devices (defaults): " + defaultAudioOutput)
                    }
        }
        

        In log I see

        qml: Outputs Audio devices List: QAudioDevice(default, , true, Output),QAudioDevice(sysdefault:CARD=MAX98357A, MAX98357A, bcm2835-i2s-HiFi HiFi-0
        Default Audio Device, false, Output)
        qml: Outputs Audio devices (defaults): QAudioDevice(default, , true, Output)
        

        And when I add

        MediaPlayer {
               id: playMessage
               source: "" 
               audioOutput: AudioOutput {
                   id: playerOutput
                   device: mediaDevices.defaultAudioOutput
        
        }
        }
        

        it SEGFAULTS

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

          Hi,

          The segmentation fault seem to have occurred in libgstreamer. Can you check that GStreamer is working properly ?

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

          K 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            The segmentation fault seem to have occurred in libgstreamer. Can you check that GStreamer is working properly ?

            K Offline
            K Offline
            Kuzma30
            wrote on last edited by Kuzma30
            #5

            @SGaist
            I hear sound only when manually specify output audio device (without parameters I get no sound, but see how time is changing 0:00:12.0 / 0:01:00.0 )

            gst-play-1.0 BabyElephantWalk60.wav --audiosink='alsasink device=hw:0,0'

            p.s.
            my asound.conf

            pcm.speakerbonnet {
               type hw card 0
            }
            
            pcm.dmixer {
               type dmix
               ipc_key 1024
               ipc_perm 0666
               slave {
                 pcm "speakerbonnet"
                 period_time 0
                 period_size 1024
                 buffer_size 8192
                 rate 44100
                 channels 2
               }
            }
            
            ctl.dmixer {
                type hw card 0
            }
            
            pcm.softvol {
                type softvol
                slave.pcm "dmixer"
                control.name "PCM"
                control.card 0
            }
            
            ctl.softvol {
                type hw card 0
            }
            
            pcm.!default {
                type             plug
                slave.pcm       "softvol"
            }
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Looks like there's an issue on your system. Are you sure it's properly configured ?

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

              K 1 Reply Last reply
              0
              • SGaistS SGaist

                Looks like there's an issue on your system. Are you sure it's properly configured ?

                K Offline
                K Offline
                Kuzma30
                wrote on last edited by
                #7

                @SGaist
                I refactor my code to use only 3 SoundEffect and change source variable in code when I need new sound. It solve my problem now but I still have non working MediaPlayer.

                K 1 Reply Last reply
                0
                • K Kuzma30

                  @SGaist
                  I refactor my code to use only 3 SoundEffect and change source variable in code when I need new sound. It solve my problem now but I still have non working MediaPlayer.

                  K Offline
                  K Offline
                  Kuzma30
                  wrote on last edited by
                  #8

                  Now some time I see

                  ALSA lib /usr/src/debug/alsa-lib/1.2.9-r0/src/pcm/pcm.c:8675:(snd_pcm_recover) underrun occurred
                  

                  in console

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

                    Are you sure alsa is properly configured for your hardware ?

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

                    K 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Are you sure alsa is properly configured for your hardware ?

                      K Offline
                      K Offline
                      Kuzma30
                      wrote on last edited by
                      #10

                      @SGaist
                      How to check this?

                      SGaistS 1 Reply Last reply
                      0
                      • K Kuzma30

                        @SGaist
                        How to check this?

                        SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Kuzma30 ask the Raspberry Pi folks.

                        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