libobs: Fix sending unclamped audio to output handler #11317
Merged
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: