Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8123661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:14:59+00:00 2026-06-06T06:14:59+00:00

I am developing an application that receives a stream of audio samples from a

  • 0

I am developing an application that receives a stream of audio samples from a remote server via custom UDP protocol. The stream consists of small sequences of samples, every sequence may have different number of channels and rate.

As I understand, the sample_spec of the stream can only be set during the stream’s creation (pa_simple_new, pa_stream_new, etc) and there is no way to switch it afterwards.

My question is: what would be the most efficient approach to these samples’ playback in PulseAudio? I see three options:

  1. Keep a single PulseAudio stream, manually resample the sample sequences and mix channels when needed (in order to feed PulseAudio with samples of the same sample_spec)
  2. Keep a single PulseAudio stream, close and reopen it with new sample_spec when specs change
  3. Keep a number of streams, one for every kind of samples I have to work with

Option 1 seems like a lot of manual work, and pretty much resource-consuming, too. Option 2 seems to be terribly inefficient. Option 3 looks like probably the best one, but I am concerned about resource consumption. Is there something I may be missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:15:00+00:00Added an answer on June 6, 2026 at 6:15 am

    Resampling yourself would be a wasted effort. You do have the option of updating the sample rate dynamically. You need to set the PA_STREAM_VARIABLE_RATE and use pa_stream_update_sample_rate(). This still doesn’t handle sample spec changes, though.

    2 and 3 are both valid, and clearly there’s a tradeoff between allocating resources up front (option 3) and having a minor performance penalty (option 2). To be quite honest, stream creation isn’t that expensive, and holding a stream shouldn’t be high overhead either (unless you’re in a severely resource-constrained environment).

    So if you’ve got a fixed number of spec/rate combinations, just create the streams upfront. If the change in spec/rate is rare, just tear down and recreate the stream again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android application that receives data about events from a server.
I am currently developing a web application that receives data from an on-site database.
I'm developing an application that receives push notifications via XMPP ( I know C2DM,
Im developing an application in Android that receives real-time data (via BT) and needs
Good Day, I'm developing an application in VC++ that communicates using UDP protocol with
I am developing an server application that will receive lists of book details from
I'm developing an application that uses webservices in python, both sides (server and client)
I'm developing an application that shall receive images from a camera device and display
I am developing a application which receives 600-700 KB of XML data from the
I am developing an application which utilizes a custom network protocol over TCP. Several

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.