Replace AudioFrame's operator= with CopyFrom().
Enforce DISALLOW_COPY_AND_ASSIGN to catch offenders.
Review URL: https://webrtc-codereview.appspot.com/1031007
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3395 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_processing/test/unit_test.cc b/webrtc/modules/audio_processing/test/unit_test.cc
index 51340e9..1baa48d 100644
--- a/webrtc/modules/audio_processing/test/unit_test.cc
+++ b/webrtc/modules/audio_processing/test/unit_test.cc
@@ -451,7 +451,8 @@
EnableAllComponents();
Init(16000, 2, 2, 2, false);
SetFrameTo(frame_, 1000);
- AudioFrame frame_copy = *frame_;
+ AudioFrame frame_copy;
+ frame_copy.CopyFrom(*frame_);
ProcessWithDefaultStreamParameters(frame_);
// Verify the processing has actually changed the frame.
EXPECT_FALSE(FrameDataAreEqual(*frame_, frame_copy));
@@ -464,13 +465,14 @@
apm_->Initialize();
SetFrameTo(frame_, 1000);
- AudioFrame initial_frame = *frame_;
+ AudioFrame initial_frame;
+ initial_frame.CopyFrom(*frame_);
ProcessWithDefaultStreamParameters(frame_);
ProcessWithDefaultStreamParameters(frame_);
// Verify the processing has actually changed the frame.
EXPECT_FALSE(FrameDataAreEqual(*frame_, initial_frame));
- frame_copy = initial_frame;
+ frame_copy.CopyFrom(initial_frame);
apm_->Initialize();
ProcessWithDefaultStreamParameters(&frame_copy);
// Verify an init here would result in different output.
@@ -478,7 +480,7 @@
ProcessWithDefaultStreamParameters(&frame_copy);
EXPECT_FALSE(FrameDataAreEqual(*frame_, frame_copy));
- frame_copy = initial_frame;
+ frame_copy.CopyFrom(initial_frame);
apm_->Initialize();
ProcessWithDefaultStreamParameters(&frame_copy);
// Test that the same value does not trigger an init.
@@ -1078,7 +1080,8 @@
for (size_t i = 0; i < kSampleRatesSize; i++) {
Init(kSampleRates[i], 2, 2, 2, false);
SetFrameTo(frame_, 1000, 2000);
- AudioFrame frame_copy = *frame_;
+ AudioFrame frame_copy;
+ frame_copy.CopyFrom(*frame_);
for (int j = 0; j < 1000; j++) {
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_TRUE(FrameDataAreEqual(*frame_, frame_copy));
@@ -1119,14 +1122,15 @@
// Verify the filter is not active through undistorted audio when:
// 1. No components are enabled...
SetFrameTo(frame_, 1000);
- AudioFrame frame_copy = *frame_;
+ AudioFrame frame_copy;
+ frame_copy.CopyFrom(*frame_);
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_TRUE(FrameDataAreEqual(*frame_, frame_copy));
// 2. Only the level estimator is enabled...
SetFrameTo(frame_, 1000);
- frame_copy = *frame_;
+ frame_copy.CopyFrom(*frame_);
EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
@@ -1135,7 +1139,7 @@
// 3. Only VAD is enabled...
SetFrameTo(frame_, 1000);
- frame_copy = *frame_;
+ frame_copy.CopyFrom(*frame_);
EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(true));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
@@ -1144,7 +1148,7 @@
// 4. Both VAD and the level estimator are enabled...
SetFrameTo(frame_, 1000);
- frame_copy = *frame_;
+ frame_copy.CopyFrom(*frame_);
EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true));
EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(true));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
@@ -1164,7 +1168,7 @@
// behavior of the AEC. Think of something more robust.
EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(true));
SetFrameTo(frame_, 1000);
- frame_copy = *frame_;
+ frame_copy.CopyFrom(*frame_);
EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(0));
EXPECT_EQ(apm_->kNoError,
apm_->echo_cancellation()->set_stream_drift_samples(0));
@@ -1182,7 +1186,7 @@
frame_->num_channels_ = 2;
frame_->sample_rate_hz_ = 32000;
SetFrameTo(frame_, 1000);
- frame_copy = *frame_;
+ frame_copy.CopyFrom(*frame_);
EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(0));
EXPECT_EQ(apm_->kNoError,
apm_->echo_cancellation()->set_stream_drift_samples(0));