diff options
author | leozwang@webrtc.org <leozwang@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2012-12-04 19:11:55 +0000 |
---|---|---|
committer | leozwang@webrtc.org <leozwang@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2012-12-04 19:11:55 +0000 |
commit | 15e35cc41b1c1c1dc9a05717dd56a31bcd4032e5 (patch) | |
tree | b7d123a736be0c96bf56195e115dbc275cca45da /voice_engine | |
parent | eeb98feb4360e779d5f3ae668f8f86038951787b (diff) | |
download | webrtc-15e35cc41b1c1c1dc9a05717dd56a31bcd4032e5.tar.gz |
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/webrtc@3239 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine')
-rw-r--r-- | voice_engine/include/voe_hardware.h | 6 | ||||
-rw-r--r-- | voice_engine/voe_hardware_impl.cc | 40 | ||||
-rw-r--r-- | voice_engine/voe_hardware_impl.h | 5 |
3 files changed, 51 insertions, 0 deletions
diff --git a/voice_engine/include/voe_hardware.h b/voice_engine/include/voe_hardware.h index 24ed1ff8..e973c110 100644 --- a/voice_engine/include/voe_hardware.h +++ b/voice_engine/include/voe_hardware.h @@ -113,6 +113,12 @@ public: // Not supported 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.* // Enables the Windows Core Audio built-in AEC. Fails on other platforms. // diff --git a/voice_engine/voe_hardware_impl.cc b/voice_engine/voe_hardware_impl.cc index 7247a696..99e65cc4 100644 --- a/voice_engine/voe_hardware_impl.cc +++ b/voice_engine/voe_hardware_impl.cc @@ -818,6 +818,46 @@ bool VoEHardwareImpl::BuiltInAECIsEnabled() const 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 } // namespace webrtc diff --git a/voice_engine/voe_hardware_impl.h b/voice_engine/voe_hardware_impl.h index c8012280..94775672 100644 --- a/voice_engine/voe_hardware_impl.h +++ b/voice_engine/voe_hardware_impl.h @@ -65,6 +65,11 @@ public: virtual int EnableBuiltInAEC(bool enable); 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: VoEHardwareImpl(voe::SharedData* shared); virtual ~VoEHardwareImpl(); |