Re: [discuss-webrtc] How to modify the audio sample rate used by WebRTC (Android)?

3,183 views
Skip to first unread message
Message has been deleted

José Carlos Pujol

unread,
Jan 5, 2017, 2:29:35 PM1/5/17
to discuss...@googlegroups.com
You need to mangle the SDP to include a line with the sprop-maxcapturerate attribute [1]. Here is an example taken from there:

m=audio 54312 RTP/AVP 101
a=rtpmap:101 opus/48000/2
a=fmtp:101 maxplaybackrate=16000; sprop-maxcapturerate=16000



On Thu, Jan 5, 2017 at 7:49 AM, Kushtrim Pacaj <kushtr...@gmail.com> wrote:
We're making a video-conferencing device, and the hardware guys said that they optimized the mic for 16 khz sample rate, and that we should use that.

Where can I specify what sample rate WebRTC uses for calls.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/5cccf47f-60a8-465b-a521-d4866dffa27b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kushtrim Pacaj

unread,
Jan 7, 2017, 12:59:28 PM1/7/17
to discuss-webrtc
Thanks you. I'll try this.


On Thursday, January 5, 2017 at 8:29:35 PM UTC+1, José Carlos Pujol wrote:
You need to mangle the SDP to include a line with the sprop-maxcapturerate attribute [1]. Here is an example taken from there:

m=audio 54312 RTP/AVP 101
a=rtpmap:101 opus/48000/2
a=fmtp:101 maxplaybackrate=16000; sprop-maxcapturerate=16000


On Thu, Jan 5, 2017 at 7:49 AM, Kushtrim Pacaj <kushtr...@gmail.com> wrote:
We're making a video-conferencing device, and the hardware guys said that they optimized the mic for 16 khz sample rate, and that we should use that.

Where can I specify what sample rate WebRTC uses for calls.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Matteo C.

unread,
Jan 9, 2017, 8:24:19 AM1/9/17
to discuss...@googlegroups.com
Hi Jose,
do you know if the sprop-maxcapturerate sdp parameter is actually implemented in WebRTC?
Last time I checked (some months ago) I didn't find any reference of sprop-maxcapturerate in the code.


Thanks,
Matteo


Henrik Andreasson

unread,
Jan 9, 2017, 9:15:21 AM1/9/17
to discuss-webrtc
AFAIK, using SDP will not lead to a modified native input sample rate.
Is it a web based client or a native client?
What platform is it?

Kushtrim Pacaj

unread,
Jan 9, 2017, 9:17:17 AM1/9/17
to discuss-webrtc
Android


On Monday, January 9, 2017 at 3:15:21 PM UTC+1, Henrik Andreassson wrote:
AFAIK, using SDP will not lead to a modified native input sample rate.
Is it a web based client or a native client?
What platform is it?
On Mon, Jan 9, 2017 at 2:24 PM, Matteo C. <matte...@gmail.com> wrote:
Hi Jose,
do you know if the sprop-maxcapturerate sdp parameter is actually implemented in WebRTC?
Last time I checked (some months ago) I didn't find any reference of sprop-maxcapturerate in the code.


Thanks,
Matteo

On Thu, Jan 5, 2017 at 8:29 PM, José Carlos Pujol <jpu...@tokbox.com> wrote:
You need to mangle the SDP to include a line with the sprop-maxcapturerate attribute [1]. Here is an example taken from there:

m=audio 54312 RTP/AVP 101
a=rtpmap:101 opus/48000/2
a=fmtp:101 maxplaybackrate=16000; sprop-maxcapturerate=16000


On Thu, Jan 5, 2017 at 7:49 AM, Kushtrim Pacaj <kushtr...@gmail.com> wrote:
We're making a video-conferencing device, and the hardware guys said that they optimized the mic for 16 khz sample rate, and that we should use that.

Where can I specify what sample rate WebRTC uses for calls.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Henrik Andreasson

unread,
Jan 9, 2017, 9:24:53 AM1/9/17
to discuss-webrtc
Is it a web based client or a native client?
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/576ea194-164a-4957-b120-2c7b8c018ee6%40googlegroups.com.

Kushtrim Pacaj

unread,
Jan 9, 2017, 5:03:03 PM1/9/17
to discuss-webrtc
Native Android

José Carlos Pujol

unread,
Jan 9, 2017, 8:07:59 PM1/9/17
to discuss...@googlegroups.com
To my understanding, modifying the SDP will affect the parameters also for native clients. Kushtrim, please let us know if it worked for you this way

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/f1b875d6-cbed-4b26-9c13-9787794161f8%40googlegroups.com.

Matteo C.

unread,
Jan 10, 2017, 3:24:30 AM1/10/17
to discuss...@googlegroups.com
Yes you're right, for instance we're passing maxaveragebitrate and maxplaybackrate in the SDP and they are correctly handled in native clients.
My point is that looking at the code these two constants are defined in mediaconstants.cc and used in webrtcvoiceengine.cc, while sprop-maxcapturerate is not present at all in the code (M52 version, I didn't check the last code) so I think it's not taken into account.

Cheers,
Matteo

Matteo C.

unread,
Jan 11, 2017, 12:33:39 PM1/11/17
to discuss...@googlegroups.com
FYI I filed this bug about sprop-maxcapturerate: https://bugs.chromium.org/p/webrtc/issues/detail?id=6970

Cheers,
Matteo

Bang Nguyen

unread,
Feb 23, 2018, 4:17:36 PM2/23/18
to discuss-webrtc
I'm not sure about Android, but on iOS I found out that we can change sample rate by 

RTCAudioSessionConfiguration

Eric Davies

unread,
Feb 24, 2018, 1:01:24 PM2/24/18
to discuss-webrtc
In the commit I'm using, which is a few months old, its
           WebRtcAudioUtils.setDefaultSampleRateHz(value);
Reply all
Reply to author
Forward
0 new messages