Remove unused members from AudioDeviceBuffer
Removes current_mic_level_, new_mic_level_ and clock_drift_, together with APIs for accessing them. Bug: webrtc:8598 Change-Id: I8e07396fcafd2a719e204730e2c7d26797bed762 Reviewed-on: https://webrtc-review.googlesource.com/39783 Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21632}
This commit is contained in:
committed by
Commit Bot
parent
d980c57c80
commit
1a50cd5894
@ -267,9 +267,7 @@ void AudioRecordJni::OnDataIsRecorded(int length) {
|
||||
// We provide one (combined) fixed delay estimate for the APM and use the
|
||||
// |playDelayMs| parameter only. Components like the AEC only sees the sum
|
||||
// of |playDelayMs| and |recDelayMs|, hence the distributions does not matter.
|
||||
audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_,
|
||||
0, // recDelayMs
|
||||
0); // clockDrift
|
||||
audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, 0);
|
||||
if (audio_device_buffer_->DeliverRecordedData() == -1) {
|
||||
RTC_LOG(INFO) << "AudioDeviceBuffer::DeliverRecordedData failed";
|
||||
}
|
||||
|
||||
@ -50,12 +50,9 @@ AudioDeviceBuffer::AudioDeviceBuffer()
|
||||
play_channels_(0),
|
||||
playing_(false),
|
||||
recording_(false),
|
||||
current_mic_level_(0),
|
||||
new_mic_level_(0),
|
||||
typing_status_(false),
|
||||
play_delay_ms_(0),
|
||||
rec_delay_ms_(0),
|
||||
clock_drift_(0),
|
||||
num_stat_reports_(0),
|
||||
last_timer_task_time_(0),
|
||||
rec_stat_count_(0),
|
||||
@ -231,15 +228,6 @@ size_t AudioDeviceBuffer::PlayoutChannels() const {
|
||||
return play_channels_;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::SetCurrentMicLevel(uint32_t level) {
|
||||
#if !defined(WEBRTC_WIN)
|
||||
// Windows uses a dedicated thread for volume APIs.
|
||||
RTC_DCHECK_RUN_ON(&recording_thread_checker_);
|
||||
#endif
|
||||
current_mic_level_ = level;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::SetTypingStatus(bool typing_status) {
|
||||
RTC_DCHECK_RUN_ON(&recording_thread_checker_);
|
||||
typing_status_ = typing_status;
|
||||
@ -252,18 +240,11 @@ void AudioDeviceBuffer::NativeAudioInterrupted() {
|
||||
recording_thread_checker_.DetachFromThread();
|
||||
}
|
||||
|
||||
uint32_t AudioDeviceBuffer::NewMicLevel() const {
|
||||
RTC_DCHECK_RUN_ON(&recording_thread_checker_);
|
||||
return new_mic_level_;
|
||||
}
|
||||
|
||||
void AudioDeviceBuffer::SetVQEData(int play_delay_ms,
|
||||
int rec_delay_ms,
|
||||
int clock_drift) {
|
||||
int rec_delay_ms) {
|
||||
RTC_DCHECK_RUN_ON(&recording_thread_checker_);
|
||||
play_delay_ms_ = play_delay_ms;
|
||||
rec_delay_ms_ = rec_delay_ms;
|
||||
clock_drift_ = clock_drift;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::SetRecordedBuffer(const void* audio_buffer,
|
||||
@ -307,15 +288,13 @@ int32_t AudioDeviceBuffer::DeliverRecordedData() {
|
||||
}
|
||||
const size_t frames = rec_buffer_.size() / rec_channels_;
|
||||
const size_t bytes_per_frame = rec_channels_ * sizeof(int16_t);
|
||||
uint32_t new_mic_level(0);
|
||||
uint32_t new_mic_level_dummy = 0;
|
||||
uint32_t total_delay_ms = play_delay_ms_ + rec_delay_ms_;
|
||||
int32_t res = audio_transport_cb_->RecordedDataIsAvailable(
|
||||
rec_buffer_.data(), frames, bytes_per_frame, rec_channels_,
|
||||
rec_sample_rate_, total_delay_ms, clock_drift_, current_mic_level_,
|
||||
typing_status_, new_mic_level);
|
||||
if (res != -1) {
|
||||
new_mic_level_ = new_mic_level;
|
||||
} else {
|
||||
rec_sample_rate_, total_delay_ms, 0, 0, typing_status_,
|
||||
new_mic_level_dummy);
|
||||
if (res == -1) {
|
||||
RTC_LOG(LS_ERROR) << "RecordedDataIsAvailable() failed";
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -95,8 +95,7 @@ class AudioDeviceBuffer {
|
||||
|
||||
virtual int32_t SetRecordedBuffer(const void* audio_buffer,
|
||||
size_t samples_per_channel);
|
||||
int32_t SetCurrentMicLevel(uint32_t level);
|
||||
virtual void SetVQEData(int play_delay_ms, int rec_delay_ms, int clock_drift);
|
||||
virtual void SetVQEData(int play_delay_ms, int rec_delay_ms);
|
||||
virtual int32_t DeliverRecordedData();
|
||||
uint32_t NewMicLevel() const;
|
||||
|
||||
@ -195,15 +194,6 @@ class AudioDeviceBuffer {
|
||||
// dynamically.
|
||||
rtc::BufferT<int16_t> rec_buffer_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
|
||||
// AGC parameters.
|
||||
#if !defined(WEBRTC_WIN)
|
||||
uint32_t current_mic_level_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
#else
|
||||
// Windows uses a dedicated thread for volume APIs.
|
||||
uint32_t current_mic_level_;
|
||||
#endif
|
||||
uint32_t new_mic_level_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
|
||||
// Contains true of a key-press has been detected.
|
||||
bool typing_status_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
|
||||
@ -211,9 +201,6 @@ class AudioDeviceBuffer {
|
||||
int play_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
int rec_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
|
||||
// Contains a clock-drift measurement.
|
||||
int clock_drift_ RTC_ACCESS_ON(recording_thread_checker_);
|
||||
|
||||
// Counts number of times LogStats() has been called.
|
||||
size_t num_stat_reports_ RTC_ACCESS_ON(task_queue_);
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ void FineAudioBuffer::DeliverRecordedData(
|
||||
while (record_buffer_.size() >= bytes_per_10_ms_) {
|
||||
device_buffer_->SetRecordedBuffer(record_buffer_.data(),
|
||||
samples_per_10_ms_);
|
||||
device_buffer_->SetVQEData(playout_delay_ms, record_delay_ms, 0);
|
||||
device_buffer_->SetVQEData(playout_delay_ms, record_delay_ms);
|
||||
device_buffer_->DeliverRecordedData();
|
||||
memmove(record_buffer_.data(), record_buffer_.data() + bytes_per_10_ms_,
|
||||
record_buffer_.size() - bytes_per_10_ms_);
|
||||
|
||||
@ -111,7 +111,7 @@ void RunFineBufferTest(int frame_size_in_samples) {
|
||||
.RetiresOnSaturation();
|
||||
}
|
||||
}
|
||||
EXPECT_CALL(audio_device_buffer, SetVQEData(_, _, _))
|
||||
EXPECT_CALL(audio_device_buffer, SetVQEData(_, _))
|
||||
.Times(kNumberOfUpdateBufferCalls - 1);
|
||||
EXPECT_CALL(audio_device_buffer, DeliverRecordedData())
|
||||
.Times(kNumberOfUpdateBufferCalls - 1)
|
||||
|
||||
@ -1607,7 +1607,7 @@ bool AudioDeviceLinuxALSA::RecThreadProcess() {
|
||||
|
||||
// TODO(xians): Shall we add 10ms buffer delay to the record delay?
|
||||
_ptrAudioBuffer->SetVQEData(_playoutDelay * 1000 / _playoutFreq,
|
||||
_recordingDelay * 1000 / _recordingFreq, 0);
|
||||
_recordingDelay * 1000 / _recordingFreq);
|
||||
|
||||
_ptrAudioBuffer->SetTypingStatus(KeyPressed());
|
||||
|
||||
|
||||
@ -1955,7 +1955,6 @@ int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData,
|
||||
|
||||
_ptrAudioBuffer->SetRecordedBuffer(bufferData, bufferSizeInSamples);
|
||||
|
||||
const uint32_t clockDrift(0);
|
||||
// TODO(andrew): this is a temporary hack, to avoid non-causal far- and
|
||||
// near-end signals at the AEC for PulseAudio. I think the system delay is
|
||||
// being correctly calculated here, but for legacy reasons we add +10 ms
|
||||
@ -1965,7 +1964,7 @@ int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData,
|
||||
recDelay -= 10;
|
||||
else
|
||||
recDelay = 0;
|
||||
_ptrAudioBuffer->SetVQEData(_sndCardPlayDelay, recDelay, clockDrift);
|
||||
_ptrAudioBuffer->SetVQEData(_sndCardPlayDelay, recDelay);
|
||||
_ptrAudioBuffer->SetTypingStatus(KeyPressed());
|
||||
// Deliver recorded samples at specified sample rate,
|
||||
// mic level etc. to the observer using callback.
|
||||
|
||||
@ -2499,7 +2499,7 @@ bool AudioDeviceMac::CaptureWorkerThread() {
|
||||
// store the recorded buffer (no action will be taken if the
|
||||
// #recorded samples is not a full buffer)
|
||||
_ptrAudioBuffer->SetRecordedBuffer((int8_t*)&recordBuffer, (uint32_t)size);
|
||||
_ptrAudioBuffer->SetVQEData(msecOnPlaySide, msecOnRecordSide, 0);
|
||||
_ptrAudioBuffer->SetVQEData(msecOnPlaySide, msecOnRecordSide);
|
||||
_ptrAudioBuffer->SetTypingStatus(KeyPressed());
|
||||
|
||||
// deliver recorded samples at specified sample rate, mic level etc.
|
||||
|
||||
@ -24,8 +24,7 @@ class MockAudioDeviceBuffer : public AudioDeviceBuffer {
|
||||
MOCK_METHOD1(GetPlayoutData, int32_t(void* audioBuffer));
|
||||
MOCK_METHOD2(SetRecordedBuffer,
|
||||
int32_t(const void* audioBuffer, size_t nSamples));
|
||||
MOCK_METHOD3(SetVQEData,
|
||||
void(int playDelayMS, int recDelayMS, int clockDrift));
|
||||
MOCK_METHOD2(SetVQEData, void(int playDelayMS, int recDelayMS));
|
||||
MOCK_METHOD0(DeliverRecordedData, int32_t());
|
||||
};
|
||||
|
||||
|
||||
@ -3062,7 +3062,7 @@ DWORD AudioDeviceWindowsCore::DoCaptureThreadPollDMO() {
|
||||
assert(sizeof(BYTE) == sizeof(int8_t));
|
||||
_ptrAudioBuffer->SetRecordedBuffer(reinterpret_cast<int8_t*>(data),
|
||||
kSamplesProduced);
|
||||
_ptrAudioBuffer->SetVQEData(0, 0, 0);
|
||||
_ptrAudioBuffer->SetVQEData(0, 0);
|
||||
|
||||
_UnLock(); // Release lock while making the callback.
|
||||
_ptrAudioBuffer->DeliverRecordedData();
|
||||
@ -3289,7 +3289,7 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread() {
|
||||
if (_ptrAudioBuffer) {
|
||||
_ptrAudioBuffer->SetRecordedBuffer((const int8_t*)syncBuffer,
|
||||
_recBlockSize);
|
||||
_ptrAudioBuffer->SetVQEData(sndCardPlayDelay, sndCardRecDelay, 0);
|
||||
_ptrAudioBuffer->SetVQEData(sndCardPlayDelay, sndCardRecDelay);
|
||||
|
||||
_ptrAudioBuffer->SetTypingStatus(KeyPressed());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user