From 8962b54a434e84efeb003d7f522eb4bc7e9cb764 Mon Sep 17 00:00:00 2001 From: henrika Date: Mon, 13 Nov 2017 16:57:58 +0100 Subject: [PATCH] Removes Set/GetRecordingChannel() from the ADM These two unused APIs are removed: SetRecordingChannel(const ChannelType channel) RecordingChannel(ChannelType* channel) const Bug: webrtc:7306 Change-Id: I3289c4b9a5eebb64cc0aa3a1c1144e9c4d6a661d Reviewed-on: https://webrtc-review.googlesource.com/22681 Reviewed-by: Fredrik Solenberg Commit-Queue: Henrik Andreassson Cr-Commit-Position: refs/heads/master@{#20667} --- media/engine/adm_helpers.cc | 5 +-- media/engine/webrtcvoiceengine_unittest.cc | 2 -- modules/audio_device/audio_device_buffer.cc | 16 --------- modules/audio_device/audio_device_buffer.h | 2 -- .../audio_device_data_observer.cc | 6 ---- modules/audio_device/audio_device_impl.cc | 35 ------------------- modules/audio_device/audio_device_impl.h | 2 -- modules/audio_device/include/audio_device.h | 6 ++-- .../audio_device/include/fake_audio_device.h | 2 -- .../audio_device/include/mock_audio_device.h | 2 -- pc/test/fakeaudiocapturemodule.cc | 18 ---------- pc/test/fakeaudiocapturemodule.h | 2 -- 12 files changed, 5 insertions(+), 93 deletions(-) diff --git a/media/engine/adm_helpers.cc b/media/engine/adm_helpers.cc index 3a1776edf3..b973ce6ebd 100644 --- a/media/engine/adm_helpers.cc +++ b/media/engine/adm_helpers.cc @@ -42,10 +42,7 @@ void SetRecordingDevice(AudioDeviceModule* adm) { return; } - // Set device and stereo mode. - if (adm->SetRecordingChannel(AudioDeviceModule::kChannelBoth) != 0) { - RTC_LOG(LS_ERROR) << "Unable to set recording channel to kChannelBoth."; - } + // Set device to default. if (adm->SetRecordingDevice(AUDIO_DEVICE_ID) != 0) { RTC_LOG(LS_ERROR) << "Unable to set recording device."; return; diff --git a/media/engine/webrtcvoiceengine_unittest.cc b/media/engine/webrtcvoiceengine_unittest.cc index e8c9a221a1..793fc7d611 100644 --- a/media/engine/webrtcvoiceengine_unittest.cc +++ b/media/engine/webrtcvoiceengine_unittest.cc @@ -90,8 +90,6 @@ void AdmSetupExpectations(webrtc::test::MockAudioDeviceModule* adm) { .WillOnce(Return(rtc::RefCountReleaseStatus::kDroppedLastRef)); #if !defined(WEBRTC_IOS) EXPECT_CALL(*adm, Recording()).WillOnce(Return(false)); - EXPECT_CALL(*adm, SetRecordingChannel(webrtc::AudioDeviceModule:: - ChannelType::kChannelBoth)).WillOnce(Return(0)); #if defined(WEBRTC_WIN) EXPECT_CALL(*adm, SetRecordingDevice( testing::Matcher( diff --git a/modules/audio_device/audio_device_buffer.cc b/modules/audio_device/audio_device_buffer.cc index b580c1669a..158a86ad6c 100644 --- a/modules/audio_device/audio_device_buffer.cc +++ b/modules/audio_device/audio_device_buffer.cc @@ -221,22 +221,6 @@ int32_t AudioDeviceBuffer::SetPlayoutChannels(size_t channels) { return 0; } -int32_t AudioDeviceBuffer::SetRecordingChannel( - const AudioDeviceModule::ChannelType channel) { - RTC_LOG(INFO) << "SetRecordingChannel(" << channel << ")"; - RTC_LOG(LS_WARNING) << "Not implemented"; - // Add DCHECK to ensure that user does not try to use this API with a non- - // default parameter. - RTC_DCHECK_EQ(channel, AudioDeviceModule::kChannelBoth); - return -1; -} - -int32_t AudioDeviceBuffer::RecordingChannel( - AudioDeviceModule::ChannelType& channel) const { - RTC_LOG(LS_WARNING) << "Not implemented"; - return -1; -} - size_t AudioDeviceBuffer::RecordingChannels() const { RTC_DCHECK(main_thread_checker_.CalledOnValidThread()); return rec_channels_; diff --git a/modules/audio_device/audio_device_buffer.h b/modules/audio_device/audio_device_buffer.h index 8b8e907e3a..38e799672a 100644 --- a/modules/audio_device/audio_device_buffer.h +++ b/modules/audio_device/audio_device_buffer.h @@ -92,8 +92,6 @@ class AudioDeviceBuffer { int32_t SetPlayoutChannels(size_t channels); size_t RecordingChannels() const; size_t PlayoutChannels() const; - int32_t SetRecordingChannel(const AudioDeviceModule::ChannelType channel); - int32_t RecordingChannel(AudioDeviceModule::ChannelType& channel) const; virtual int32_t SetRecordedBuffer(const void* audio_buffer, size_t samples_per_channel); diff --git a/modules/audio_device/audio_device_data_observer.cc b/modules/audio_device/audio_device_data_observer.cc index e3b7f2430e..f37d808e23 100644 --- a/modules/audio_device/audio_device_data_observer.cc +++ b/modules/audio_device/audio_device_data_observer.cc @@ -241,12 +241,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport { int32_t StereoRecording(bool* enabled) const override { return impl_->StereoRecording(enabled); } - int32_t SetRecordingChannel(const ChannelType channel) override { - return impl_->SetRecordingChannel(channel); - } - int32_t RecordingChannel(ChannelType* channel) const override { - return impl_->RecordingChannel(channel); - } int32_t PlayoutDelay(uint16_t* delay_ms) const override { return impl_->PlayoutDelay(delay_ms); } diff --git a/modules/audio_device/audio_device_impl.cc b/modules/audio_device/audio_device_impl.cc index a8321f402a..46489dafb2 100644 --- a/modules/audio_device/audio_device_impl.cc +++ b/modules/audio_device/audio_device_impl.cc @@ -524,41 +524,6 @@ int32_t AudioDeviceModuleImpl::StereoRecording(bool* enabled) const { return 0; } -int32_t AudioDeviceModuleImpl::SetRecordingChannel(const ChannelType channel) { - if (channel == kChannelBoth) { - RTC_LOG(INFO) << __FUNCTION__ << "(both)"; - } else if (channel == kChannelLeft) { - RTC_LOG(INFO) << __FUNCTION__ << "(left)"; - } else { - RTC_LOG(INFO) << __FUNCTION__ << "(right)"; - } - CHECKinitialized_(); - bool stereo = false; - if (audio_device_->StereoRecording(stereo) == -1) { - RTC_LOG(WARNING) << "recording in stereo is not supported"; - return -1; - } - return audio_device_buffer_.SetRecordingChannel(channel); -} - -int32_t AudioDeviceModuleImpl::RecordingChannel(ChannelType* channel) const { - RTC_LOG(INFO) << __FUNCTION__; - CHECKinitialized_(); - ChannelType chType; - if (audio_device_buffer_.RecordingChannel(chType) == -1) { - return -1; - } - *channel = chType; - if (*channel == kChannelBoth) { - RTC_LOG(INFO) << "output: both"; - } else if (*channel == kChannelLeft) { - RTC_LOG(INFO) << "output: left"; - } else { - RTC_LOG(INFO) << "output: right"; - } - return 0; -} - int32_t AudioDeviceModuleImpl::StereoPlayoutIsAvailable(bool* available) const { RTC_LOG(INFO) << __FUNCTION__; CHECKinitialized_(); diff --git a/modules/audio_device/audio_device_impl.h b/modules/audio_device/audio_device_impl.h index 02daabc907..cd4d0ccefd 100644 --- a/modules/audio_device/audio_device_impl.h +++ b/modules/audio_device/audio_device_impl.h @@ -128,8 +128,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule { int32_t StereoRecordingIsAvailable(bool* available) const override; int32_t SetStereoRecording(bool enable) override; int32_t StereoRecording(bool* enabled) const override; - int32_t SetRecordingChannel(const ChannelType channel) override; - int32_t RecordingChannel(ChannelType* channel) const override; // Delay information and control int32_t PlayoutDelay(uint16_t* delayMS) const override; diff --git a/modules/audio_device/include/audio_device.h b/modules/audio_device/include/audio_device.h index 5720888acc..52d367adbd 100644 --- a/modules/audio_device/include/audio_device.h +++ b/modules/audio_device/include/audio_device.h @@ -42,6 +42,7 @@ class AudioDeviceModule : public rtc::RefCountInterface { kDefaultDevice = -2 }; + // TODO(bugs.webrtc.org/7306): deprecated. enum ChannelType { kChannelLeft = 0, kChannelRight = 1, @@ -141,8 +142,9 @@ class AudioDeviceModule : public rtc::RefCountInterface { virtual int32_t StereoRecordingIsAvailable(bool* available) const = 0; virtual int32_t SetStereoRecording(bool enable) = 0; virtual int32_t StereoRecording(bool* enabled) const = 0; - virtual int32_t SetRecordingChannel(const ChannelType channel) = 0; - virtual int32_t RecordingChannel(ChannelType* channel) const = 0; + // TODO(bugs.webrtc.org/7306): deprecated. + virtual int32_t SetRecordingChannel(const ChannelType channel) { return -1; } + virtual int32_t RecordingChannel(ChannelType* channel) const { return -1; } // Playout delay virtual int32_t PlayoutDelay(uint16_t* delayMS) const = 0; diff --git a/modules/audio_device/include/fake_audio_device.h b/modules/audio_device/include/fake_audio_device.h index c49e9fe455..74822d5d56 100644 --- a/modules/audio_device/include/fake_audio_device.h +++ b/modules/audio_device/include/fake_audio_device.h @@ -99,8 +99,6 @@ class FakeAudioDeviceModule : public AudioDeviceModule { return 0; } int32_t StereoRecording(bool* enabled) const override { return 0; } - int32_t SetRecordingChannel(const ChannelType channel) override { return 0; } - int32_t RecordingChannel(ChannelType* channel) const override { return 0; } int32_t PlayoutDelay(uint16_t* delayMS) const override { *delayMS = 0; return 0; diff --git a/modules/audio_device/include/mock_audio_device.h b/modules/audio_device/include/mock_audio_device.h index a98d2aca82..bfc76601a1 100644 --- a/modules/audio_device/include/mock_audio_device.h +++ b/modules/audio_device/include/mock_audio_device.h @@ -83,8 +83,6 @@ class MockAudioDeviceModule : public AudioDeviceModule { MOCK_CONST_METHOD1(StereoRecordingIsAvailable, int32_t(bool* available)); MOCK_METHOD1(SetStereoRecording, int32_t(bool enable)); MOCK_CONST_METHOD1(StereoRecording, int32_t(bool* enabled)); - 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_METHOD1(SetRecordingSampleRate, int32_t(const uint32_t samplesPerSec)); MOCK_CONST_METHOD1(RecordingSampleRate, int32_t(uint32_t* samplesPerSec)); diff --git a/pc/test/fakeaudiocapturemodule.cc b/pc/test/fakeaudiocapturemodule.cc index dbbc0441cd..901137623e 100644 --- a/pc/test/fakeaudiocapturemodule.cc +++ b/pc/test/fakeaudiocapturemodule.cc @@ -388,24 +388,6 @@ int32_t FakeAudioCaptureModule::StereoRecording(bool* /*enabled*/) const { return 0; } -int32_t FakeAudioCaptureModule::SetRecordingChannel( - const ChannelType channel) { - if (channel != AudioDeviceModule::kChannelBoth) { - // There is no right or left in mono. I.e. kChannelBoth should be used for - // mono. - RTC_NOTREACHED(); - return -1; - } - return 0; -} - -int32_t FakeAudioCaptureModule::RecordingChannel(ChannelType* channel) const { - // Stereo recording not supported. However, WebRTC ADM returns kChannelBoth - // in that case. Do the same here. - *channel = AudioDeviceModule::kChannelBoth; - return 0; -} - int32_t FakeAudioCaptureModule::PlayoutDelay(uint16_t* delay_ms) const { // No delay since audio frames are dropped. *delay_ms = 0; diff --git a/pc/test/fakeaudiocapturemodule.h b/pc/test/fakeaudiocapturemodule.h index aa10efc0e1..9851bc3529 100644 --- a/pc/test/fakeaudiocapturemodule.h +++ b/pc/test/fakeaudiocapturemodule.h @@ -125,8 +125,6 @@ class FakeAudioCaptureModule int32_t StereoRecordingIsAvailable(bool* available) const override; int32_t SetStereoRecording(bool enable) override; int32_t StereoRecording(bool* enabled) const override; - int32_t SetRecordingChannel(const ChannelType channel) override; - int32_t RecordingChannel(ChannelType* channel) const override; int32_t PlayoutDelay(uint16_t* delay_ms) const override;