diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn index f3bca7cab1..5558ab1ca6 100644 --- a/api/audio/BUILD.gn +++ b/api/audio/BUILD.gn @@ -18,7 +18,6 @@ rtc_source_set("audio_frame_api") { deps = [ "../../:typedefs", "../../rtc_base:checks", - "../../rtc_base:deprecation", "../../rtc_base:rtc_base_approved", ] } diff --git a/api/audio/audio_frame.cc b/api/audio/audio_frame.cc index 108a523d0b..864188dee4 100644 --- a/api/audio/audio_frame.cc +++ b/api/audio/audio_frame.cc @@ -13,7 +13,6 @@ #include "api/audio/audio_frame.h" #include "rtc_base/checks.h" -#include "rtc_base/numerics/safe_conversions.h" #include "rtc_base/timeutils.h" namespace webrtc { @@ -43,12 +42,12 @@ void AudioFrame::ResetWithoutMuting() { } void AudioFrame::UpdateFrame(uint32_t timestamp, - const int16_t* data, - size_t samples_per_channel, - int sample_rate_hz, - SpeechType speech_type, - VADActivity vad_activity, - size_t num_channels) { + const int16_t* data, + size_t samples_per_channel, + int sample_rate_hz, + SpeechType speech_type, + VADActivity vad_activity, + size_t num_channels) { timestamp_ = timestamp; samples_per_channel_ = samples_per_channel; sample_rate_hz_ = sample_rate_hz; @@ -119,62 +118,6 @@ void AudioFrame::Mute() { bool AudioFrame::muted() const { return muted_; } -AudioFrame& AudioFrame::operator>>=(const int rhs) { - RTC_CHECK_GT(num_channels_, 0); - RTC_CHECK_LT(num_channels_, 3); - if ((num_channels_ > 2) || (num_channels_ < 1)) return *this; - if (muted_) return *this; - - for (size_t i = 0; i < samples_per_channel_ * num_channels_; i++) { - data_[i] = static_cast(data_[i] >> rhs); - } - return *this; -} - -AudioFrame& AudioFrame::operator+=(const AudioFrame& rhs) { - // Sanity check - RTC_CHECK_GT(num_channels_, 0); - RTC_CHECK_LT(num_channels_, 3); - if ((num_channels_ > 2) || (num_channels_ < 1)) return *this; - if (num_channels_ != rhs.num_channels_) return *this; - - bool noPrevData = muted_; - if (samples_per_channel_ != rhs.samples_per_channel_) { - if (samples_per_channel_ == 0) { - // special case we have no data to start with - samples_per_channel_ = rhs.samples_per_channel_; - noPrevData = true; - } else { - return *this; - } - } - - if ((vad_activity_ == kVadActive) || rhs.vad_activity_ == kVadActive) { - vad_activity_ = kVadActive; - } else if (vad_activity_ == kVadUnknown || rhs.vad_activity_ == kVadUnknown) { - vad_activity_ = kVadUnknown; - } - - if (speech_type_ != rhs.speech_type_) speech_type_ = kUndefined; - - if (!rhs.muted()) { - muted_ = false; - if (noPrevData) { - memcpy(data_, rhs.data(), - sizeof(int16_t) * rhs.samples_per_channel_ * num_channels_); - } else { - // IMPROVEMENT this can be done very fast in assembly - for (size_t i = 0; i < samples_per_channel_ * num_channels_; i++) { - int32_t wrap_guard = - static_cast(data_[i]) + static_cast(rhs.data_[i]); - data_[i] = rtc::saturated_cast(wrap_guard); - } - } - } - - return *this; -} - // static const int16_t* AudioFrame::empty_data() { static const int16_t kEmptyData[kMaxDataSizeSamples] = {0}; diff --git a/api/audio/audio_frame.h b/api/audio/audio_frame.h index 5cb2019706..d69f607ce6 100644 --- a/api/audio/audio_frame.h +++ b/api/audio/audio_frame.h @@ -11,11 +11,7 @@ #ifndef API_AUDIO_AUDIO_FRAME_H_ #define API_AUDIO_AUDIO_FRAME_H_ -#include -#include - #include "rtc_base/constructormagic.h" -#include "rtc_base/deprecation.h" #include "typedefs.h" // NOLINT(build/include) namespace webrtc { @@ -68,17 +64,6 @@ class AudioFrame { // ResetWithoutMuting() to skip this wasteful zeroing. void ResetWithoutMuting(); - // TODO(solenberg): Remove once downstream users of AudioFrame have updated. - RTC_DEPRECATED - void UpdateFrame(int id, uint32_t timestamp, const int16_t* data, - size_t samples_per_channel, int sample_rate_hz, - SpeechType speech_type, VADActivity vad_activity, - size_t num_channels = 1) { - RTC_UNUSED(id); - UpdateFrame(timestamp, data, samples_per_channel, sample_rate_hz, - speech_type, vad_activity, num_channels); - } - void UpdateFrame(uint32_t timestamp, const int16_t* data, size_t samples_per_channel, int sample_rate_hz, SpeechType speech_type, VADActivity vad_activity, @@ -108,13 +93,6 @@ class AudioFrame { // Frame is muted by default. bool muted() const; - // These methods are deprecated. Use the functions in - // webrtc/audio/utility instead. These methods will exists for a - // short period of time until webrtc clients have updated. See - // webrtc:6548 for details. - RTC_DEPRECATED AudioFrame& operator>>=(const int rhs); - RTC_DEPRECATED AudioFrame& operator+=(const AudioFrame& rhs); - // RTP timestamp of the first sample in the AudioFrame. uint32_t timestamp_ = 0; // Time since the first frame in milliseconds.