Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Output audio queue #1253

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

LebedevRI
Copy link
Contributor

This is incomplete.

Currently, the queue is placed before all of our elements,
which is great to precache input and not stutter through
the times where there's IO latency spikes,
but if there's a CPU latency spike, we may still stutter
because we still need to process the input.

By also caching the final output, we should be safe from that.

This introduces subtleties: when changing parameters
of said modules, the changes will no longer be immediate,
but delayed by the cache length. So we must flush the pipeline's caches.

This sounds simple, but the obvious approach does not work,
and the one that works (seek to the current position)
causes temporary stutters. This isn't nice.

Also, probes need to be taken after the output queue.

Also, the way the fader is implemented just doesn't work with this approach.

But overall, this works better than i expected.

It is placed in the very beginning, not elsewhere.
We want to get the segments in sync with when they are passed onto
the sound card, and now that is after the output queue.
Now that we have an output audio queue, which is fully processed,
if we change some parameters of the elements (that are placed
before said queue), the changes will not propagate to the output
immediately, as expected. But that is not what one wants.

So when changing parameters of such elements, we must ensure to
flush the now-stale caches, thus forcing re-processing of the audio.

Now, this works, but i really don't understand
how flushing is supposed to work in gstreamer,
it just doesn't seem to work if there is no seeking,
so there is some jumps when changing parameters now.
Maybe this can be avoided?

Also, fader needs to be reimplemented.
It fundamentally does not fit into this structure.
@jonaski
Copy link
Member

jonaski commented Aug 2, 2023

Since "use-buffering" is set to false for the input queue, low/high watermark settings are ignored, I'm not sure about "max-size-time", but not much need for the loop just for one extra line.

@LebedevRI
Copy link
Contributor Author

Since "use-buffering" is set to false for the input queue, low/high watermark settings are ignored, I'm not sure about "max-size-time", but not much need for the loop just for one extra line.

Ah. That's because i thought that it would only disable messages, but not buffering altogether,

I'm mainly just not sure where to start untangling all this (+gapless playback, +proper faders),
since it's all rather interconnected //and// does not have any non-manual tests.

@LebedevRI
Copy link
Contributor Author

Since "use-buffering" is set to false for the input queue, low/high watermark settings are ignored, I'm not sure about "max-size-time", but not much need for the loop just for one extra line.

Ah. That's because i thought that it would only disable messages, but not buffering altogether,

After looking through gstqueue2.c it is not obvious to me why "use-buffering"=false
would disable the whole buffering and not just the status messages.

I'm mainly just not sure where to start untangling all this (+gapless playback, +proper faders), since it's all rather interconnected //and// does not have any non-manual tests.

@jonaski
Copy link
Member

jonaski commented Aug 6, 2023

I think you are right about this, Strawberry is a bit too sensitive to CPU high load, more so than compared to for example VLC. I've experienced this a few times when I've been compiling Qt at the same time as playing music, I think it is also worse on Windows than on Linux.
But I don't understand how we can place a queue after the volumes without issues. I've tried to experiment with this too, see the gstenginepipeline_queue branch.
Maybe we could ask on the GStreamer mailinglist about this? Are you an the devel mailinglist?

@jonaski
Copy link
Member

jonaski commented Aug 6, 2023

Sorry that I've created conflicts for you now.

@LebedevRI
Copy link
Contributor Author

I think you are right about this, Strawberry is a bit too sensitive to CPU high load, more so than compared to for example VLC. I've experienced this a few times when I've been compiling Qt at the same time as playing music, I think it is also worse on Windows than on Linux.

But I don't understand how we can place a queue after the volumes without issues. I've tried to experiment with this too, see the gstenginepipeline_queue branch.

What kind of issues, specifically?
The PR as-is already "just" works for me, the main problem here is cache invalidation.

That being said, please maybe don't merge this/that, i believe i want to first deal with
the gap-less playback issue first. It should be easier to start untangling from that side.

Maybe we could ask on the GStreamer mailinglist about this?

Are you an the devel mailinglist?

No.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants