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

Update audio track delegate on output format change #1500

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

levs42
Copy link
Contributor

@levs42 levs42 commented Jun 28, 2024

Description & motivation

This PR fixes an issue where audio tracks from multitrack mixer don't preserve their delegates. This leads to a state where AudioCodec doesn't receive current audio format from the mixer.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@shogo4405 shogo4405 force-pushed the main branch 2 times, most recently from 6cf677a to 5f95e3f Compare June 29, 2024 04:08
@@ -26,7 +26,7 @@ final class IOAudioMixerByMultiTrack: IOAudioMixerConvertible {
}
for id in tracks.keys {
buffers[id] = .init(outputFormat)
tracks[id] = .init(id: id, outputFormat: outputFormat)
tracks[id] = .init(id: id, outputFormat: outputFormat, delegate: self)
Copy link
Owner

Choose a reason for hiding this comment

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

[IMO]

  • I remember encountering a bug in some version of Swift where specifying a delegate in the constructor in a Release build would cause the weak reference to become nil. I thought it would be better to set the delegate in this line.
  • tracks[id]?.delegate = self

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated

@shogo4405 shogo4405 merged commit 7c1d292 into shogo4405:main Jul 5, 2024
1 check failed
@shogo4405 shogo4405 added this to the 1.9.2 milestone Jul 5, 2024
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.

2 participants