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 <solenberg@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20667}
This commit is contained in:
henrika
2017-11-13 16:57:58 +01:00
committed by Commit Bot
parent c0e680463a
commit 8962b54a43
12 changed files with 5 additions and 93 deletions

View File

@ -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;

View File

@ -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<webrtc::AudioDeviceModule::WindowsDeviceType>(

View File

@ -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_;

View File

@ -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);

View File

@ -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);
}

View File

@ -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_();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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;