Expose Set and Get Recording/Playout sample rate apis
Message: This is the first cl to add Set/Get Recording and Playout sample rate apis. In this cl, apis are enabled but returns -1, will add android implementation in next cl, it's easy for review and coding. Description: This CL expose fours voice engine apis, SetRecordingSampleRate, RecordingSampleRate, SetPlayoutSampleRate, PlayoutSampleRate. BUG=none TEST=trybots Review URL: https://webrtc-codereview.appspot.com/626004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3239 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f4e070eca5
commit
96bcac8fbb
@ -113,6 +113,12 @@ public:
|
|||||||
// Not supported
|
// Not supported
|
||||||
virtual int GetLoudspeakerStatus(bool& enabled) = 0;
|
virtual int GetLoudspeakerStatus(bool& enabled) = 0;
|
||||||
|
|
||||||
|
// Native sample rate controls (samples/sec)
|
||||||
|
virtual int SetRecordingSampleRate(unsigned int samples_per_sec) = 0;
|
||||||
|
virtual int RecordingSampleRate(unsigned int* samples_per_sec) const = 0;
|
||||||
|
virtual int SetPlayoutSampleRate(unsigned int samples_per_sec) = 0;
|
||||||
|
virtual int PlayoutSampleRate(unsigned int* samples_per_sec) const = 0;
|
||||||
|
|
||||||
// *Experimental - not recommended for use.*
|
// *Experimental - not recommended for use.*
|
||||||
// Enables the Windows Core Audio built-in AEC. Fails on other platforms.
|
// Enables the Windows Core Audio built-in AEC. Fails on other platforms.
|
||||||
//
|
//
|
||||||
|
@ -818,6 +818,46 @@ bool VoEHardwareImpl::BuiltInAECIsEnabled() const
|
|||||||
return _shared->audio_device()->BuiltInAECIsEnabled();
|
return _shared->audio_device()->BuiltInAECIsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoEHardwareImpl::SetRecordingSampleRate(unsigned int samples_per_sec) {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
"%s", __FUNCTION__);
|
||||||
|
if (!_shared->statistics().Initialized()) {
|
||||||
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _shared->audio_device()->SetRecordingSampleRate(samples_per_sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoEHardwareImpl::RecordingSampleRate(unsigned int* samples_per_sec) const {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
"%s", __FUNCTION__);
|
||||||
|
if (!_shared->statistics().Initialized()) {
|
||||||
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _shared->audio_device()->RecordingSampleRate(samples_per_sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoEHardwareImpl::SetPlayoutSampleRate(unsigned int samples_per_sec) {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
"%s", __FUNCTION__);
|
||||||
|
if (!_shared->statistics().Initialized()) {
|
||||||
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _shared->audio_device()->SetPlayoutSampleRate(samples_per_sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoEHardwareImpl::PlayoutSampleRate(unsigned int* samples_per_sec) const {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
"%s", __FUNCTION__);
|
||||||
|
if (!_shared->statistics().Initialized()) {
|
||||||
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _shared->audio_device()->PlayoutSampleRate(samples_per_sec);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WEBRTC_VOICE_ENGINE_HARDWARE_API
|
#endif // WEBRTC_VOICE_ENGINE_HARDWARE_API
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -65,6 +65,11 @@ public:
|
|||||||
virtual int EnableBuiltInAEC(bool enable);
|
virtual int EnableBuiltInAEC(bool enable);
|
||||||
virtual bool BuiltInAECIsEnabled() const;
|
virtual bool BuiltInAECIsEnabled() const;
|
||||||
|
|
||||||
|
virtual int SetRecordingSampleRate(unsigned int samples_per_sec);
|
||||||
|
virtual int RecordingSampleRate(unsigned int* samples_per_sec) const;
|
||||||
|
virtual int SetPlayoutSampleRate(unsigned int samples_per_sec);
|
||||||
|
virtual int PlayoutSampleRate(unsigned int* samples_per_sec) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VoEHardwareImpl(voe::SharedData* shared);
|
VoEHardwareImpl(voe::SharedData* shared);
|
||||||
virtual ~VoEHardwareImpl();
|
virtual ~VoEHardwareImpl();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user