Set Audio Level of a Specific Media Stream

720 views
Skip to first unread message

Mike Anderson

unread,
Sep 23, 2013, 8:50:41 PM9/23/13
to discuss...@googlegroups.com
Hello All,
Does anyone know if it is possible to modify the level (volume) of an individual media stream in webRTC?
I am using the native API, so I can potentially access any level along the chain, though higher would be better.

Thanks
-Mike

Damian Kaczmarek

unread,
Sep 26, 2013, 3:38:16 AM9/26/13
to discuss...@googlegroups.com
Hi Mike,
Actually I was gonna ask the same question today.  My best bet is webrtc::voe::ChannelManager but it's not exposed
publically anywhere. Maybe changing the objects to public manually would be a correct, yet very ugly strategy.
Have you found anything better?
Regards,
Damian

Henrik Andreasson

unread,
Sep 26, 2013, 3:43:45 AM9/26/13
to discuss...@googlegroups.com
You can set the volume on the audio tag which is used to render the audio track.


--
 
---
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.
For more options, visit https://groups.google.com/groups/opt_out.

Damian Kaczmarek

unread,
Sep 26, 2013, 3:45:27 AM9/26/13
to discuss...@googlegroups.com
That is correct but the question is about the native API and there are no audio tags. WebRTC binds automatically to the soundcard.


2013/9/26 Henrik Andreasson <hen...@webrtc.org>

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/6W5wJ76AugI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.

Henrik Andreasson

unread,
Sep 26, 2013, 4:16:09 AM9/26/13
to discuss...@googlegroups.com
The native APIs are only available to service development of JS APIs and can can be changed/removed at any time. We are unable to provide any support in this area since our work is focused on building APIs that can be used by everyone in browsers.
Henrik Andreasson | Software Engineer | hen...@google.com | +46 70 376 91 74

Damian Kaczmarek

unread,
Sep 26, 2013, 5:11:24 AM9/26/13
to discuss...@googlegroups.com
Thanks for your attention Henrik,
That's perfectly understandable and I am not asking for anything outside the scope of browser usage. I am strictly interested in WebRTC itself. So supposedly I am writing a browser, what should my approach be to get audio streams (supposedly for my own audio tags) so that I can handle (change volume) them myself. Should I provide my own AudioDeviceModuleImpl and handle the sound card myself?
Best Regards,
Damian


2013/9/26 Henrik Andreasson <hen...@google.com>

Henrik Andreasson

unread,
Sep 26, 2013, 6:23:20 AM9/26/13
to discuss...@googlegroups.com

Damian Kaczmarek

unread,
Sep 26, 2013, 6:52:49 AM9/26/13
to discuss...@googlegroups.com
I see, so basically you get this API it by supplying the current voice engine:
static VoEVolumeControl* GetInterface(VoiceEngine* voiceEngine);
Any (sane) way to get the current voice engine? I have only non-sane ideas. ;-)
Many thanks,
Damian



2013/9/26 Henrik Andreasson <hen...@webrtc.org>

Henrik Andreasson

unread,
Sep 26, 2013, 7:53:34 AM9/26/13
to discuss...@googlegroups.com
You can find test examples here: https://code.google.com/p/webrtc/source/browse/trunk/webrtc/voice_engine/test/auto_test/voe_standard_test.cc

That's all I can add on this topic at this stage.

Mike Anderson

unread,
Sep 26, 2013, 6:44:34 PM9/26/13
to discuss...@googlegroups.com
Thanks Henrik, Damian,
This is definitely helpful, though I also can't see a sane way to bring it up to the ObjC or Java API levels, the voice engine is pretty deep in the framework.
I also noticed that the control is only built under the WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API flag. Is this even set in the case for building for iOS and Android?

Thanks
-Mike

Andrew Benton

unread,
Feb 5, 2014, 4:22:09 AM2/5/14
to discuss...@googlegroups.com
I am currently trying to adjust the volume of input and output streams using the native api wrapped in java. I'd be very interested in the answer to this question.

Mike, if you had any luck getting this figured out please do share.

Lars Bork

unread,
Nov 23, 2016, 6:59:05 PM11/23/16
to discuss-webrtc
Hi Mike, hi Andrew,

I'd really appreciate if someone could help me with this. Were you able to come up with a solution? I am trying something similar right now: I need access to volume controls for tracks on the high-level api.

Thanks a lot for any suggestions, tips and ideas!

Fredrik Solenberg

unread,
Dec 1, 2016, 5:03:55 AM12/1/16
to discuss-webrtc
In C++, the AudioSourceInterface has a SetVolume() method: https://chromium.googlesource.com/external/webrtc/+/master/webrtc/api/mediastreaminterface.h#177

This is however only implemented for RemoteAudioSource. So you can adjust the level of received streams. For transmitted streams, your best options is to supply your own instance of AudioDeviceModule to PeerConnectionFactory and then use APIs on the ADM to set the mic level.

The SetVolume() interface is currently not implemented in Java/objc, but there's a CL outstanding where it is being considered for objc: https://codereview.webrtc.org/2534843002/

- Fredrik

Dax Booysen

unread,
Feb 23, 2017, 2:31:57 AM2/23/17
to discuss-webrtc
Here is a Java counterpart to the above - here are the changes: https://codereview.webrtc.org/2710683009

-Dax

Suman Cherukuri

unread,
Nov 4, 2017, 2:29:22 PM11/4/17
to discuss-webrtc
I see this in mediastreaminterface.h

// TODO(deadbeef): Makes all the interfaces pure virtual after they're

  // implemented in chromium.


  // Sets the volume of the source. |volume| is in  the range of [0, 10].

  // TODO(tommi): This method should be on the track and ideally volume should

  // be applied in the track in a way that does not affect clones of the track.

  virtual void SetVolume(double volume) {}


Is this why when I call setVolume with 0, it is not working?

Dax Booysen

unread,
Nov 4, 2017, 6:13:01 PM11/4/17
to discuss...@googlegroups.com
I find the volume is relative to the session before it starts 

--
Dax Booysen
Director of Engineering
Reply all
Reply to author
Forward
0 new messages