Removes Set/GetLoudspeakerStatus APIs from the ADM.
int32_t SetLoudspeakerStatus(bool enable) int32_t GetLoudspeakerStatus(bool* enabled) const These APIs are only implemented on iOS and they do not belong in the native audio layer since the client can achieve the same functionality by using the shared audio session in sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h. It also gives the client a better flexibility in how the audio routing is done. Bug: webrtc:7306 Change-Id: I853e2f57e0f5ae0a0f9fc4729ce961d81f92588b Reviewed-on: https://webrtc-review.googlesource.com/23740 Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20721}
This commit is contained in:
@ -385,16 +385,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
input_.AttachAudioBuffer(audioBuffer);
|
||||
}
|
||||
|
||||
int32_t SetLoudspeakerStatus(bool enable) override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t GetLoudspeakerStatus(bool& enable) const override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Returns true if the device both supports built in AEC and the device
|
||||
// is not blacklisted.
|
||||
// Currently, if OpenSL ES is used in both directions, this method will still
|
||||
|
||||
@ -244,12 +244,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t PlayoutDelay(uint16_t* delay_ms) const override {
|
||||
return impl_->PlayoutDelay(delay_ms);
|
||||
}
|
||||
int32_t SetLoudspeakerStatus(bool enable) override {
|
||||
return impl_->SetLoudspeakerStatus(enable);
|
||||
}
|
||||
int32_t GetLoudspeakerStatus(bool* enabled) const override {
|
||||
return impl_->GetLoudspeakerStatus(enabled);
|
||||
}
|
||||
bool BuiltInAECIsAvailable() const override {
|
||||
return impl_->BuiltInAECIsAvailable();
|
||||
}
|
||||
|
||||
@ -13,16 +13,6 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
int32_t AudioDeviceGeneric::SetLoudspeakerStatus(bool enable) {
|
||||
RTC_LOG_F(LS_ERROR) << "Not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceGeneric::GetLoudspeakerStatus(bool& enable) const {
|
||||
RTC_LOG_F(LS_ERROR) << "Not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AudioDeviceGeneric::BuiltInAECIsAvailable() const {
|
||||
RTC_LOG_F(LS_ERROR) << "Not supported on this platform";
|
||||
return false;
|
||||
|
||||
@ -116,10 +116,6 @@ class AudioDeviceGeneric {
|
||||
// Delay information and control
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const = 0;
|
||||
|
||||
// Speaker audio routing (for mobile devices)
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable);
|
||||
virtual int32_t GetLoudspeakerStatus(bool& enable) const;
|
||||
|
||||
// Android only
|
||||
virtual bool BuiltInAECIsAvailable() const;
|
||||
virtual bool BuiltInAGCIsAvailable() const;
|
||||
|
||||
@ -823,26 +823,6 @@ int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceModuleImpl::SetLoudspeakerStatus(bool enable) {
|
||||
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
||||
CHECKinitialized_();
|
||||
if (audio_device_->SetLoudspeakerStatus(enable) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceModuleImpl::GetLoudspeakerStatus(bool* enabled) const {
|
||||
RTC_LOG(INFO) << __FUNCTION__;
|
||||
CHECKinitialized_();
|
||||
int32_t ok = 0;
|
||||
if (audio_device_->GetLoudspeakerStatus(*enabled) != 0) {
|
||||
ok = -1;
|
||||
}
|
||||
RTC_LOG(INFO) << "output: " << ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const {
|
||||
RTC_LOG(INFO) << __FUNCTION__;
|
||||
CHECKinitialized__BOOL();
|
||||
|
||||
@ -132,10 +132,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
// Delay information and control
|
||||
int32_t PlayoutDelay(uint16_t* delayMS) const override;
|
||||
|
||||
// Mobile device specific functions
|
||||
int32_t SetLoudspeakerStatus(bool enable) override;
|
||||
int32_t GetLoudspeakerStatus(bool* enabled) const override;
|
||||
|
||||
bool BuiltInAECIsAvailable() const override;
|
||||
int32_t EnableBuiltInAEC(bool enable) override;
|
||||
bool BuiltInAGCIsAvailable() const override;
|
||||
|
||||
@ -50,10 +50,10 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
};
|
||||
|
||||
public:
|
||||
// Create an ADM.
|
||||
// Creates an ADM.
|
||||
static rtc::scoped_refptr<AudioDeviceModule> Create(
|
||||
const AudioLayer audio_layer);
|
||||
// TODO(bugs.webrtc.org/7306): deprecated.
|
||||
// TODO(bugs.webrtc.org/7306): deprecated (to be removed).
|
||||
static rtc::scoped_refptr<AudioDeviceModule> Create(
|
||||
const int32_t id,
|
||||
const AudioLayer audio_layer);
|
||||
@ -149,8 +149,7 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
// Playout delay
|
||||
virtual int32_t PlayoutDelay(uint16_t* delayMS) const = 0;
|
||||
|
||||
// Deprecated. Don't use.
|
||||
// TODO(henrika): remove these methods.
|
||||
// TODO(bugs.webrtc.org/7306): deprecated (to be removed).
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) {
|
||||
return -1;
|
||||
}
|
||||
@ -164,9 +163,9 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Mobile device specific functions
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable) = 0;
|
||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const = 0;
|
||||
// TODO(bugs.webrtc.org/7306): deprecated (to be removed).
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable) { return -1; }
|
||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const { return -1; }
|
||||
|
||||
// Only supported on Android.
|
||||
virtual bool BuiltInAECIsAvailable() const = 0;
|
||||
|
||||
@ -103,8 +103,6 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
|
||||
*delayMS = 0;
|
||||
return 0;
|
||||
}
|
||||
int32_t SetLoudspeakerStatus(bool enable) override { return 0; }
|
||||
int32_t GetLoudspeakerStatus(bool* enabled) const override { return 0; }
|
||||
bool BuiltInAECIsAvailable() const override { return false; }
|
||||
int32_t EnableBuiltInAEC(bool enable) override { return -1; }
|
||||
bool BuiltInAGCIsAvailable() const override { return false; }
|
||||
|
||||
@ -84,8 +84,6 @@ class MockAudioDeviceModule : public AudioDeviceModule {
|
||||
MOCK_METHOD1(SetStereoRecording, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(StereoRecording, int32_t(bool* enabled));
|
||||
MOCK_CONST_METHOD1(PlayoutDelay, int32_t(uint16_t* delayMS));
|
||||
MOCK_METHOD1(SetLoudspeakerStatus, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(GetLoudspeakerStatus, int32_t(bool* enabled));
|
||||
MOCK_CONST_METHOD0(BuiltInAECIsAvailable, bool());
|
||||
MOCK_CONST_METHOD0(BuiltInAGCIsAvailable, bool());
|
||||
MOCK_CONST_METHOD0(BuiltInNSIsAvailable, bool());
|
||||
|
||||
@ -70,9 +70,6 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
||||
int32_t StopRecording() override;
|
||||
bool Recording() const override { return recording_; }
|
||||
|
||||
int32_t SetLoudspeakerStatus(bool enable) override;
|
||||
int32_t GetLoudspeakerStatus(bool& enabled) const override;
|
||||
|
||||
// These methods returns hard-coded delay values and not dynamic delay
|
||||
// estimates. The reason is that iOS supports a built-in AEC and the WebRTC
|
||||
// AEC will always be disabled in the Libjingle layer to avoid running two
|
||||
|
||||
@ -303,42 +303,6 @@ int32_t AudioDeviceIOS::StopRecording() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Change the default receiver playout route to speaker.
|
||||
int32_t AudioDeviceIOS::SetLoudspeakerStatus(bool enable) {
|
||||
LOGI() << "SetLoudspeakerStatus(" << enable << ")";
|
||||
|
||||
RTCAudioSession* session = [RTCAudioSession sharedInstance];
|
||||
[session lockForConfiguration];
|
||||
NSString* category = session.category;
|
||||
AVAudioSessionCategoryOptions options = session.categoryOptions;
|
||||
// Respect old category options if category is
|
||||
// AVAudioSessionCategoryPlayAndRecord. Otherwise reset it since old options
|
||||
// might not be valid for this category.
|
||||
if ([category isEqualToString:AVAudioSessionCategoryPlayAndRecord]) {
|
||||
if (enable) {
|
||||
options |= AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||
} else {
|
||||
options &= ~AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||
}
|
||||
} else {
|
||||
options = AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||
}
|
||||
NSError* error = nil;
|
||||
BOOL success =
|
||||
[session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:options error:&error];
|
||||
ios::CheckAndLogError(success, error);
|
||||
[session unlockForConfiguration];
|
||||
return (error == nil) ? 0 : -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::GetLoudspeakerStatus(bool& enabled) const {
|
||||
LOGI() << "GetLoudspeakerStatus";
|
||||
RTCAudioSession* session = [RTCAudioSession sharedInstance];
|
||||
AVAudioSessionCategoryOptions options = session.categoryOptions;
|
||||
enabled = options & AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::PlayoutDelay(uint16_t& delayMS) const {
|
||||
delayMS = kFixedPlayoutDelayEstimate;
|
||||
return 0;
|
||||
|
||||
@ -394,16 +394,6 @@ int32_t FakeAudioCaptureModule::PlayoutDelay(uint16_t* delay_ms) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SetLoudspeakerStatus(bool /*enable*/) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::GetLoudspeakerStatus(bool* /*enabled*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FakeAudioCaptureModule::OnMessage(rtc::Message* msg) {
|
||||
switch (msg->message_id) {
|
||||
case MSG_START_PROCESS:
|
||||
|
||||
@ -128,8 +128,6 @@ class FakeAudioCaptureModule
|
||||
|
||||
int32_t PlayoutDelay(uint16_t* delay_ms) const override;
|
||||
|
||||
int32_t SetLoudspeakerStatus(bool enable) override;
|
||||
int32_t GetLoudspeakerStatus(bool* enabled) const override;
|
||||
bool BuiltInAECIsAvailable() const override { return false; }
|
||||
int32_t EnableBuiltInAEC(bool enable) override { return -1; }
|
||||
bool BuiltInAGCIsAvailable() const override { return false; }
|
||||
|
||||
Reference in New Issue
Block a user