Move functionality out from AudioFrame and into AudioFrameOperations.
This CL is in preparation to move the AudioFrame into webrtc/api. The
AudioFrame is a POD type used for representing 10ms of audio. It
appears as a parameter and return value of interfaces being migrated
to webrtc/api, in particular AudioMixer.
Here, methods operator+=, operator>>=, Mute are
moved into a new target webrtc/audio/utility/audio_frame_operations,
and dependencies are changed to use
the new versions. The old AudioFrame methods are marked deprecated.
The audio frame utilities in webrtc/modules/utility:audio_frame_operations
are also moved to the new location.
TBR=kjellander@webrtc.org
BUG=webrtc:6548
NOPRESUBMIT=True
Review-Url: https://codereview.webrtc.org/2424173003
Cr-Commit-Position: refs/heads/master@{#15413}
diff --git a/webrtc/voice_engine/BUILD.gn b/webrtc/voice_engine/BUILD.gn
index f68b642..6413c18 100644
--- a/webrtc/voice_engine/BUILD.gn
+++ b/webrtc/voice_engine/BUILD.gn
@@ -90,6 +90,7 @@
"../api:audio_mixer_api",
"../api:call_api",
"../api:transport_api",
+ "../audio/utility:audio_frame_operations",
"../base:rtc_base_approved",
"../common_audio",
"../logging:rtc_event_log_api",
diff --git a/webrtc/voice_engine/DEPS b/webrtc/voice_engine/DEPS
index 18efd81..9f6d0d5 100644
--- a/webrtc/voice_engine/DEPS
+++ b/webrtc/voice_engine/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+webrtc/audio/utility/audio_frame_operations.h",
"+webrtc/base",
"+webrtc/call",
"+webrtc/common_audio",
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 8d95c7b..dc93dc7 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <utility>
+#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/base/array_view.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/criticalsection.h"
@@ -32,7 +33,6 @@
#include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
-#include "webrtc/modules/utility/include/audio_frame_operations.h"
#include "webrtc/modules/utility/include/process_thread.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
@@ -613,7 +613,7 @@
// TODO(henrik.lundin): We should be able to do better than this. But we
// will have to go through all the cases below where the audio samples may
// be used, and handle the muted case in some way.
- audioFrame->Mute();
+ AudioFrameOperations::Mute(audioFrame);
}
// Convert module ID to internal VoE channel ID
diff --git a/webrtc/voice_engine/output_mixer.cc b/webrtc/voice_engine/output_mixer.cc
index 28dd34e..32a7c4e 100644
--- a/webrtc/voice_engine/output_mixer.cc
+++ b/webrtc/voice_engine/output_mixer.cc
@@ -10,9 +10,9 @@
#include "webrtc/voice_engine/output_mixer.h"
+#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
-#include "webrtc/modules/utility/include/audio_frame_operations.h"
#include "webrtc/system_wrappers/include/file_wrapper.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc
index 834510d..8876e33 100644
--- a/webrtc/voice_engine/transmit_mixer.cc
+++ b/webrtc/voice_engine/transmit_mixer.cc
@@ -12,9 +12,9 @@
#include <memory>
+#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/base/logging.h"
-#include "webrtc/modules/utility/include/audio_frame_operations.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/voice_engine/channel.h"
diff --git a/webrtc/voice_engine/utility.cc b/webrtc/voice_engine/utility.cc
index 88c60fd..595c711 100644
--- a/webrtc/voice_engine/utility.cc
+++ b/webrtc/voice_engine/utility.cc
@@ -10,13 +10,13 @@
#include "webrtc/voice_engine/utility.h"
+#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/common_audio/resampler/include/push_resampler.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/modules/utility/include/audio_frame_operations.h"
#include "webrtc/voice_engine/voice_engine_defines.h"
namespace webrtc {
diff --git a/webrtc/voice_engine/voe_external_media_impl.cc b/webrtc/voice_engine/voe_external_media_impl.cc
index 6f02495..85305c8 100644
--- a/webrtc/voice_engine/voe_external_media_impl.cc
+++ b/webrtc/voice_engine/voe_external_media_impl.cc
@@ -10,6 +10,7 @@
#include "webrtc/voice_engine/voe_external_media_impl.h"
+#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/voice_engine/channel.h"
#include "webrtc/voice_engine/include/voe_errors.h"
@@ -149,7 +150,7 @@
desired_sample_rate_hz == 0 ? -1 : desired_sample_rate_hz;
auto ret = channelPtr->GetAudioFrameWithMuted(channel, frame);
if (ret == MixerParticipant::AudioFrameInfo::kMuted) {
- frame->Mute();
+ AudioFrameOperations::Mute(frame);
}
return ret == MixerParticipant::AudioFrameInfo::kError ? -1 : 0;
}