libobs: Fix sending unclamped audio to output handler#11317
Merged
RytoEX merged 1 commit intoobsproject:masterfrom Sep 26, 2024
Merged
libobs: Fix sending unclamped audio to output handler#11317RytoEX merged 1 commit intoobsproject:masterfrom
RytoEX merged 1 commit intoobsproject:masterfrom
Conversation
The variable `input.conversion.allow_clipping` was left uninitialized. This could result in randomly sending unclamped audio to the output handlers that did not request the conversion.
6e70ec5 to
3720f3d
Compare
derrod
approved these changes
Sep 26, 2024
Member
derrod
left a comment
There was a problem hiding this comment.
An oversight on my part when I originally introduced this feature.
Hopefully we've not blown anybody's ears out by allowing audio on Twitch to clip 😅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The variable
input.conversion.allow_clippingwas left uninitialized. This could result in randomly sending unclamped audio to the output handlers that did not request the conversion.To avoid the same initialized variables again when adding a new variable to the structure, I initialized
audioat the declaration so that all other variables are initialized to zero.Motivation and Context
The member variable
allow_clippingwas introduced by the commit dcee4fc in #8289.In the function
audio_output_connect, which allows the parameterconversionto be null to indicate no conversion is requested,the variable
allow_clippingwas not initialized when the conversion was not requested.I'm writing a plugin that calls
audio_output_connectthroughobs_add_raw_audio_callbacklike this.When following the code to see what is the default value of
allow_clipping, I realized it was never initialized.How Has This Been Tested?
Had a modification below to log
allow_clippingjust before it was used.Then, called
obs_add_raw_audio_callbacktwice withconversion=NULL.Checked the log and saw
allow_clippingis uninitialized.Without this commit,
allow_clippingsometimes get non-zero value.With this commit, I confirmed
allow_clippingis always 0.Types of changes
Checklist: