Adding a copy constructor for the Config in AudioProcessing
Bug: webrtc:11180 Change-Id: I4621f83c0441fda55d0f81606174c004668dd6c6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161325 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30015}
This commit is contained in:
@ -247,6 +247,23 @@ 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 {
|
||||
Pipeline();
|
||||
@ -387,17 +404,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
|
||||
bool enabled = false;
|
||||
} level_estimation;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
std::string ToString() const;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user