Remove custom constructors for AudioProcessing::Config.
This CL follows the "Rule of zero". Those constructors made no sense compared to default generated ones, since all members are POD. They were introduced to quiet a memory sanitizer warning, which apparently was misleading. As a bonus, the struct is now movable. Bug: webrtc:11180, webrtc:9855 Change-Id: Iff9fd950bec8040bc6e7e7ece33cc49c5f453f5d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161381 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Yves Gerey <yvesg@google.com> Cr-Commit-Position: refs/heads/master@{#30023}
This commit is contained in:
@ -2692,4 +2692,13 @@ TEST(ApmConfiguration, HandlingOfRateCombinations) {
|
||||
capture_channel_counts);
|
||||
}
|
||||
|
||||
TEST(ApmConfiguration, SelfAssignment) {
|
||||
// At some point memory sanitizer was complaining about self-assigment.
|
||||
// Make sure we don't regress.
|
||||
AudioProcessing::Config config;
|
||||
AudioProcessing::Config* config2 = &config;
|
||||
*config2 = *config2; // Workaround -Wself-assign-overloaded
|
||||
SUCCEED(); // Real success is absence of defects from asan/msan/ubsan.
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -247,22 +247,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
|
||||
// submodule resets, affecting the audio quality. Use the RuntimeSetting
|
||||
// construct for runtime configuration.
|
||||
struct RTC_EXPORT Config {
|
||||
Config() = default;
|
||||
|
||||
// Explicit copy assignment implementation to avoid issues with memory
|
||||
// sanitizer complaints in case of self-assignment.
|
||||
// TODO(peah): Add buildflag to ensure that this is only included for memory
|
||||
// sanitizer builds.
|
||||
Config& operator=(const Config& config) {
|
||||
if (this != &config) {
|
||||
memcpy(this, &config, sizeof(*this));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Explicit copy constructor needed to avoid errors due to the above
|
||||
// implemented copy assignment operator.
|
||||
Config(const Config& config) { *this = config; }
|
||||
|
||||
// Sets the properties of the audio processing pipeline.
|
||||
struct RTC_EXPORT Pipeline {
|
||||
|
Reference in New Issue
Block a user