Remove deprecated methods from AudioFrame.

Bug: webrtc:6548
Change-Id: I85bdba3acbef3216b3d836515dde10188ff0dbc6
Reviewed-on: https://webrtc-review.googlesource.com/54304
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22824}
This commit is contained in:
Fredrik Solenberg 2018-04-11 13:00:18 +02:00 committed by Commit Bot
parent 27af5db5e0
commit 03bfc738b3
3 changed files with 6 additions and 86 deletions

View File

@ -18,7 +18,6 @@ rtc_source_set("audio_frame_api") {
deps = [
"../../:typedefs",
"../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved",
]
}

View File

@ -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<int16_t>(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<int32_t>(data_[i]) + static_cast<int32_t>(rhs.data_[i]);
data_[i] = rtc::saturated_cast<int16_t>(wrap_guard);
}
}
}
return *this;
}
// static
const int16_t* AudioFrame::empty_data() {
static const int16_t kEmptyData[kMaxDataSizeSamples] = {0};

View File

@ -11,11 +11,7 @@
#ifndef API_AUDIO_AUDIO_FRAME_H_
#define API_AUDIO_AUDIO_FRAME_H_
#include <stdint.h>
#include <stdlib.h>
#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.