Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Multimedia
  4. QtMultimedia 6 - QPulseAudioSink how to set stream name?
Forum Updated to NodeBB v4.3 + New Features

QtMultimedia 6 - QPulseAudioSink how to set stream name?

Scheduled Pinned Locked Moved Unsolved Qt Multimedia
1 Posts 1 Posters 186 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.
  • O Offline
    O Offline
    OlegAn
    wrote on last edited by OlegAn
    #1

    pa_stream_new_with_proplist function (https://freedesktop.org/software/pulseaudio/doxygen/stream_8h.html#a5bd70e309f09679753499fa198713672) accepts name argument, which is used to distinguish audio streams.
    This function is called from QPulseAudioSink::open():

    m_stream = pa_stream_new_with_proplist(pulseEngine->context(), m_streamName.constData(),
                                               &m_spec, &channel_map, propList);
    

    But the problem is m_streamName is always initilized like this (in the same open() method):

        if (m_streamName.isNull())
            m_streamName =
                    QStringLiteral("QtmPulseStream-%1-%2").arg(::getpid()).arg(quintptr(this)).toUtf8();
    

    This makes the stream name a random string every app launch ("QtmPulseStream-...."), making it impossible to remember which output device to use (for example, there's such setting in KDE, but random stream name makes this setting single-shot and thus useless).

    I can probably add output device setting in my app, or inherit QAudioSink and hack it somehow, but this is not the question here. The question is how to set m_streamName? Or is it designed to be random like this?

    This problem does not exists in Qt5+gstreamer, there stream name is always equal to application name and the association app->device is preserved between restarts. No idea how it happens b/c the code for QPulseAudioSink is identical.

    In Qt6 when using QT_MEDIA_BACKEND=gstreamer the behavior is slightly different: I see app name in as the stream name in KDE audio settings, but it still does not remember the association app-to-device, so it seems like there's randomness still. Also, no idea how backend changes audio sink behavior, does ffmpeg or gtreamer override stream name afterwards?

    1 Reply Last reply
    0
    • Nhan NguyenN Nhan Nguyen moved this topic from General and Desktop on

    • Login

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