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

Pulse: Stop calling user callback before stream start #142

Closed
wants to merge 1 commit into from

Conversation

achronop
Copy link
Contributor

@achronop achronop commented Aug 2, 2016

PulseAudio uses pre buffering which means that fires once write callback during the setup before stream uncork. This is responsible for a huge number of warnings during linux debug testing described by Bug 1286041.

This PR solves the issue by hooking the write callback after stream uncork. For this reason the user callback must be called once manually at that point. In order to be called by the same thread as the rest of them it is done through a defer event.

@achronop
Copy link
Contributor Author

achronop commented Aug 2, 2016

@kinetiknz since Paul is on PTO can you please have a look?

@achronop
Copy link
Contributor Author

achronop commented Aug 2, 2016

@kinetiknz
Copy link
Collaborator

5526dd2 is unrelated (owned_critical_section isn't even used in the pulse backend!) so please split it out. Also, as I've asked before, please stop making updates to the copy in Gecko's tree directly, it's a recipe for losing changes in situations like this.

I'm also not happy that this wrapper has been made recursive in the pthreads implementation ( please don't propagate use of this wrapper until this is resolved) - the correct solution is to remove the use of recursive locks in the audiounit backend. The Windows backend explicitly prohibits recursion; the behaviour should match across platforms as much as possible, and I do not want this code polluted with recursive locks (un)intentionally. cc @padenot

@kinetiknz
Copy link
Collaborator

d1d57d1 needs a reference to the BMO bug that you're fixing and some rationale for why this change is being made added to the commit message.

WRAP(pa_stream_set_write_callback)(stm->output_stream, stream_write_callback, stm);
// De-register write cb here and register after PA is on ready state
// This will avoid calling the callback before stream start
WRAP(pa_stream_set_write_callback)(stm->output_stream, NULL, stm);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no callback registered at this point, so why do we need to set it to NULL explicitly?

@achronop
Copy link
Contributor Author

achronop commented Aug 3, 2016

@kinetiknz: I pushed a new version according to your comments. I've changed a little the way to avoid the pre buffering callback. Let me know what you think.

@@ -120,6 +122,7 @@ struct cubeb_stream {
pa_sample_spec input_sample_spec;
int shutdown;
float volume;
int state;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a cubeb_state since that's what it holds.

@kinetiknz
Copy link
Collaborator

Thanks, looks good. Merged in b42b7597 with state's type changed.

@kinetiknz kinetiknz closed this Aug 4, 2016
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