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

Deinterleave decoded audio #117

Merged
merged 6 commits into from Aug 29, 2018
Merged

Deinterleave decoded audio #117

merged 6 commits into from Aug 29, 2018

Conversation

@ferjm
Copy link
Member

ferjm commented Aug 28, 2018

Fixes #55

@ferjm ferjm requested a review from Manishearth Aug 28, 2018
@ferjm
Copy link
Member Author

ferjm commented Aug 28, 2018

decodebin.connect_pad_added(move |_, src_pad| {
// We only want a sink per audio stream.
// Ignore any additional source pads just in case.
if src_pad.is_linked() {

This comment has been minimized.

@sdroege

sdroege Aug 28, 2018

Contributor

This is never going to be true. What you want to check here is if linking to the next sinkpad fails because the pad is already linked

.map_err(|_| ())?;
let pipeline_ = pipeline.clone();
let callbacks_ = callbacks.clone();
deinterleave.connect_pad_added(move |_, src_pad| {

This comment has been minimized.

@sdroege

sdroege Aug 28, 2018

Contributor

You create a reference cycle here: pipeline -> deinterleave -> pipeline.

Best to use weak references (pipeline.downgrade() and later pipeline.upgrade()) for passing into the closure. Same bug elsewhere probably

@@ -44,13 +54,14 @@ unsafe impl Send for AudioDecoderCallbacks {}
unsafe impl Sync for AudioDecoderCallbacks {}

pub struct AudioDecoderCallbacksBuilder {
eos: Option<Box<FnBox(u32) + Send + 'static>>,
eos: Option<Box<FnBox() + Send + 'static>>,

This comment has been minimized.

@Manishearth

Manishearth Aug 28, 2018

Member

can we still pass down channels here so we don't have to use shared mutable state on the DOM side to deal with this?

This comment has been minimized.

@ferjm

ferjm Aug 29, 2018

Author Member

We still need to use shared mutable state to build the final decoded audio from the progress callbacks and to create the final AudioBuffer content when receiving the eos callback. I think we can infer the number of channels from the final decoded audio array, so we don't need to send the channel count param through the eos callback.

@Manishearth
Copy link
Member

Manishearth commented Aug 28, 2018

I don't understand most of this, I'll defer to @sdroege's review

@ferjm
Copy link
Member Author

ferjm commented Aug 29, 2018

@sdroege
Copy link
Contributor

sdroege commented Aug 29, 2018

Looks good but you probably want to check for similar circular references in other closures

@ferjm ferjm merged commit 44ad355 into servo:master Aug 29, 2018
@ferjm ferjm deleted the ferjm:deinterleave branch Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.