Removes more unused ADM APIs:
- RecordingDelay() - LastError() Bug: webrtc:7306 Change-Id: I3bb9cd243a1464f0ba612787c854eeb6602c7e38 Reviewed-on: https://webrtc-review.googlesource.com/12060 Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20326}
This commit is contained in:
parent
0743814fb8
commit
6592f2cfd2
@ -620,8 +620,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
||||
<< *options.recording_sample_rate;
|
||||
if (adm()->SetRecordingSampleRate(*options.recording_sample_rate)) {
|
||||
LOG(LS_WARNING) << "SetRecordingSampleRate("
|
||||
<< *options.recording_sample_rate << ") failed, err="
|
||||
<< adm()->LastError();
|
||||
<< *options.recording_sample_rate << ") failed.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -629,8 +628,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
||||
LOG(LS_INFO) << "Playout sample rate is " << *options.playout_sample_rate;
|
||||
if (adm()->SetPlayoutSampleRate(*options.playout_sample_rate)) {
|
||||
LOG(LS_WARNING) << "SetPlayoutSampleRate("
|
||||
<< *options.playout_sample_rate << ") failed, err="
|
||||
<< adm()->LastError();
|
||||
<< *options.playout_sample_rate << ") failed.";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -383,14 +383,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t RecordingDelay(uint16_t& delay_ms) const override {
|
||||
// Best guess we can do is to use half of the estimated total delay.
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
delay_ms = audio_manager_->GetDelayEstimateInMilliseconds() / 2;
|
||||
RTC_DCHECK_GT(delay_ms, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
output_.AttachAudioBuffer(audioBuffer);
|
||||
|
||||
@ -120,7 +120,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override {
|
||||
return impl_->ActiveAudioLayer(audio_layer);
|
||||
}
|
||||
ErrorCode LastError() const override { return impl_->LastError(); }
|
||||
int32_t Init() override { return impl_->Init(); }
|
||||
int32_t Terminate() override { return impl_->Terminate(); }
|
||||
bool Initialized() const override { return impl_->Initialized(); }
|
||||
@ -253,9 +252,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t PlayoutDelay(uint16_t* delay_ms) const override {
|
||||
return impl_->PlayoutDelay(delay_ms);
|
||||
}
|
||||
int32_t RecordingDelay(uint16_t* delay_ms) const override {
|
||||
return impl_->RecordingDelay(delay_ms);
|
||||
}
|
||||
int32_t SetRecordingSampleRate(const uint32_t samples_per_sec) override {
|
||||
return impl_->SetRecordingSampleRate(samples_per_sec);
|
||||
}
|
||||
|
||||
@ -115,7 +115,6 @@ class AudioDeviceGeneric {
|
||||
|
||||
// Delay information and control
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const = 0;
|
||||
virtual int32_t RecordingDelay(uint16_t& delayMS) const = 0;
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec);
|
||||
|
||||
@ -272,13 +272,6 @@ int32_t AudioDeviceModuleImpl::ActiveAudioLayer(AudioLayer* audioLayer) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO(henrika): remove this API.
|
||||
AudioDeviceModule::ErrorCode AudioDeviceModuleImpl::LastError() const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
LOG(WARNING) << "Not supported";
|
||||
return kAdmErrNone;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceModuleImpl::Init() {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
if (initialized_)
|
||||
@ -858,19 +851,6 @@ int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceModuleImpl::RecordingDelay(uint16_t* delayMS) const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECKinitialized_();
|
||||
uint16_t delay = 0;
|
||||
if (audio_device_->RecordingDelay(delay) == -1) {
|
||||
LOG(LERROR) << "failed to retrieve the recording delay";
|
||||
return -1;
|
||||
}
|
||||
*delayMS = delay;
|
||||
LOG(INFO) << "output: " << *delayMS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceModuleImpl::SetRecordingSampleRate(
|
||||
const uint32_t samplesPerSec) {
|
||||
LOG(INFO) << __FUNCTION__ << "(" << samplesPerSec << ")";
|
||||
|
||||
@ -47,9 +47,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
// Retrieve the currently utilized audio layer
|
||||
int32_t ActiveAudioLayer(AudioLayer* audioLayer) const override;
|
||||
|
||||
// Error handling
|
||||
ErrorCode LastError() const override;
|
||||
|
||||
// Full-duplex transportation of PCM audio
|
||||
int32_t RegisterAudioCallback(AudioTransport* audioCallback) override;
|
||||
|
||||
@ -136,7 +133,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
|
||||
// Delay information and control
|
||||
int32_t PlayoutDelay(uint16_t* delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t* delayMS) const override;
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) override;
|
||||
|
||||
@ -156,7 +156,5 @@ int32_t AudioDeviceDummy::StereoRecording(bool& enabled) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::PlayoutDelay(uint16_t& delayMS) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::RecordingDelay(uint16_t& delayMS) const { return -1; }
|
||||
|
||||
void AudioDeviceDummy::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -109,7 +109,6 @@ class AudioDeviceDummy : public AudioDeviceGeneric {
|
||||
|
||||
// Delay information and control
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
};
|
||||
|
||||
@ -395,8 +395,6 @@ int32_t FileAudioDevice::PlayoutDelay(uint16_t& delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::RecordingDelay(uint16_t& delayMS) const { return -1; }
|
||||
|
||||
void FileAudioDevice::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
|
||||
@ -129,7 +129,6 @@ class FileAudioDevice : public AudioDeviceGeneric {
|
||||
|
||||
// Delay information and control
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
|
||||
@ -19,6 +19,8 @@ namespace webrtc {
|
||||
|
||||
class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
public:
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
enum ErrorCode {
|
||||
kAdmErrNone = 0,
|
||||
kAdmErrArgument = 1
|
||||
@ -48,6 +50,7 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
|
||||
public:
|
||||
// Create an ADM.
|
||||
// TODO(henrika): remove |id|.
|
||||
static rtc::scoped_refptr<AudioDeviceModule> Create(
|
||||
const int32_t id,
|
||||
const AudioLayer audio_layer);
|
||||
@ -55,8 +58,9 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
// Retrieve the currently utilized audio layer
|
||||
virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const = 0;
|
||||
|
||||
// Error handling
|
||||
virtual ErrorCode LastError() const = 0;
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual ErrorCode LastError() const { return kAdmErrNone; }
|
||||
|
||||
// Full-duplex transportation of PCM audio
|
||||
virtual int32_t RegisterAudioCallback(AudioTransport* audioCallback) = 0;
|
||||
@ -142,9 +146,12 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
virtual int32_t SetRecordingChannel(const ChannelType channel) = 0;
|
||||
virtual int32_t RecordingChannel(ChannelType* channel) const = 0;
|
||||
|
||||
// Delay information and control
|
||||
// Playout delay
|
||||
virtual int32_t PlayoutDelay(uint16_t* delayMS) const = 0;
|
||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const = 0;
|
||||
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const { return -1; }
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) = 0;
|
||||
|
||||
@ -42,7 +42,6 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
|
||||
int32_t Terminate() override { return 0; }
|
||||
|
||||
int32_t ActiveAudioLayer(AudioLayer* audioLayer) const override { return 0; }
|
||||
ErrorCode LastError() const override { return kAdmErrNone; }
|
||||
bool Initialized() const override { return true; }
|
||||
int16_t PlayoutDevices() override { return 0; }
|
||||
int16_t RecordingDevices() override { return 0; }
|
||||
@ -101,7 +100,6 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
|
||||
*delayMS = 0;
|
||||
return 0;
|
||||
}
|
||||
int32_t RecordingDelay(uint16_t* delayMS) const override { return 0; }
|
||||
int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -86,7 +86,6 @@ class MockAudioDeviceModule : public AudioDeviceModule {
|
||||
MOCK_METHOD1(SetRecordingChannel, int32_t(const ChannelType channel));
|
||||
MOCK_CONST_METHOD1(RecordingChannel, int32_t(ChannelType* channel));
|
||||
MOCK_CONST_METHOD1(PlayoutDelay, int32_t(uint16_t* delayMS));
|
||||
MOCK_CONST_METHOD1(RecordingDelay, int32_t(uint16_t* delayMS));
|
||||
MOCK_METHOD1(SetRecordingSampleRate, int32_t(const uint32_t samplesPerSec));
|
||||
MOCK_CONST_METHOD1(RecordingSampleRate, int32_t(uint32_t* samplesPerSec));
|
||||
MOCK_METHOD1(SetPlayoutSampleRate, int32_t(const uint32_t samplesPerSec));
|
||||
|
||||
@ -83,7 +83,6 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
||||
// A/V-sync is not supported on iOS. However, we avoid adding error messages
|
||||
// the log by using these dummy implementations instead.
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
// Native audio parameters stored during construction.
|
||||
// These methods are unique for the iOS implementation.
|
||||
|
||||
@ -354,11 +354,6 @@ int32_t AudioDeviceIOS::PlayoutDelay(uint16_t& delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::RecordingDelay(uint16_t& delayMS) const {
|
||||
delayMS = kFixedRecordDelayEstimate;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AudioDeviceIOS::GetPlayoutAudioParameters(AudioParameters* params) const {
|
||||
LOGI() << "GetPlayoutAudioParameters";
|
||||
RTC_DCHECK(playout_parameters_.is_valid());
|
||||
|
||||
@ -1425,13 +1425,6 @@ int32_t AudioDeviceLinuxALSA::PlayoutDelay(uint16_t& delayMS) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::RecordingDelay(uint16_t& delayMS) const
|
||||
{
|
||||
// Adding 10ms adjusted value to the record delay due to 10ms buffering.
|
||||
delayMS = (uint16_t)(10 + _recordingDelay * 1000 / _recordingFreq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::Playing() const
|
||||
{
|
||||
return (_playing);
|
||||
|
||||
@ -123,7 +123,6 @@ public:
|
||||
|
||||
// Delay information and control
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
|
||||
@ -1272,12 +1272,6 @@ int32_t AudioDeviceLinuxPulse::PlayoutDelay(uint16_t& delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::RecordingDelay(uint16_t& delayMS) const {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
delayMS = (uint16_t)_sndCardRecDelay;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::Playing() const {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
return (_playing);
|
||||
|
||||
@ -185,7 +185,6 @@ public:
|
||||
|
||||
// Delay information and control
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
|
||||
@ -1553,13 +1553,6 @@ int32_t AudioDeviceMac::PlayoutDelay(uint16_t& delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::RecordingDelay(uint16_t& delayMS) const {
|
||||
int32_t captureDelayUs = AtomicGet32(&_captureDelayUs);
|
||||
delayMS =
|
||||
static_cast<uint16_t>(1e-3 * (captureDelayUs + _captureLatencyUs) + 0.5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AudioDeviceMac::Playing() const {
|
||||
return (_playing);
|
||||
}
|
||||
|
||||
@ -151,7 +151,6 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
|
||||
// Delay information and control
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
|
||||
virtual int32_t RecordingDelay(uint16_t& delayMS) const;
|
||||
|
||||
virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer);
|
||||
|
||||
|
||||
@ -3032,17 +3032,6 @@ int32_t AudioDeviceWindowsCore::PlayoutDelay(uint16_t& delayMS) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RecordingDelay
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::RecordingDelay(uint16_t& delayMS) const
|
||||
{
|
||||
rtc::CritScope critScoped(&_critSect);
|
||||
delayMS = static_cast<uint16_t>(_sndCardRecDelay);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Playing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -173,7 +173,6 @@ public:
|
||||
|
||||
// Delay information and control
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
|
||||
virtual int32_t RecordingDelay(uint16_t& delayMS) const;
|
||||
|
||||
virtual int32_t EnableBuiltInAEC(bool enable);
|
||||
|
||||
|
||||
@ -74,11 +74,6 @@ int32_t FakeAudioCaptureModule::ActiveAudioLayer(
|
||||
return 0;
|
||||
}
|
||||
|
||||
webrtc::AudioDeviceModule::ErrorCode FakeAudioCaptureModule::LastError() const {
|
||||
RTC_NOTREACHED();
|
||||
return webrtc::AudioDeviceModule::kAdmErrNone;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::RegisterAudioCallback(
|
||||
webrtc::AudioTransport* audio_callback) {
|
||||
rtc::CritScope cs(&crit_callback_);
|
||||
@ -417,11 +412,6 @@ int32_t FakeAudioCaptureModule::PlayoutDelay(uint16_t* delay_ms) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::RecordingDelay(uint16_t* /*delay_ms*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SetRecordingSampleRate(
|
||||
const uint32_t /*samples_per_sec*/) {
|
||||
RTC_NOTREACHED();
|
||||
|
||||
@ -54,8 +54,6 @@ class FakeAudioCaptureModule
|
||||
|
||||
int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override;
|
||||
|
||||
ErrorCode LastError() const override;
|
||||
|
||||
// Note: Calling this method from a callback may result in deadlock.
|
||||
int32_t RegisterAudioCallback(
|
||||
webrtc::AudioTransport* audio_callback) override;
|
||||
@ -131,7 +129,6 @@ class FakeAudioCaptureModule
|
||||
int32_t RecordingChannel(ChannelType* channel) const override;
|
||||
|
||||
int32_t PlayoutDelay(uint16_t* delay_ms) const override;
|
||||
int32_t RecordingDelay(uint16_t* delay_ms) const override;
|
||||
|
||||
int32_t SetRecordingSampleRate(const uint32_t samples_per_sec) override;
|
||||
int32_t RecordingSampleRate(uint32_t* samples_per_sec) const override;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user