awslabs / amazon-kinesis-video-streams-webrtc-sdk-android

Android SDK for interfacing with Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
58 stars 37 forks source link

Audio Sample Rate update #86

Closed sangavi-iderize closed 1 year ago

sangavi-iderize commented 1 year ago

HI Team, I have an condition to update the Sample rate from 48000 to 16000, Not able to update the codes, also not able to access the methods spend lotz of time on this, Need support to overcome this issue

sirknightj commented 1 year ago

Hey @sangavi-iderize, could you explain a bit more about what you mean by "Not able to update the codes, also not able to access the methods"? We need more information to be able to help out there.

To override both the input and output audio rate, create an audio device module and give it to the PeerConnectionFactory here:

peerConnectionFactory =
                PeerConnectionFactory.builder()
                        .setVideoDecoderFactory(new DefaultVideoDecoderFactory(rootEglBase.getEglBaseContext()))
                        .setVideoEncoderFactory(new DefaultVideoEncoderFactory(rootEglBase.getEglBaseContext(), ENABLE_INTEL_VP8_ENCODER, ENABLE_H264_HIGH_PROFILE))
                        .setAudioDeviceModule(JavaAudioDeviceModule.builder(getApplicationContext())
                                .setSampleRate(16000)
                                .createAudioDeviceModule())
                        .createPeerConnectionFactory();

For more information on setSampleRate, its documentation is here.