How to get audio producer volume?

Hello,
I am researching mediasoup-broadcaster-demo. When I created an audio consumer, how should I get the volume of it?

This is my step:
1 Create a RecvTransport* using Device::CreateRecvTransport();
2 Create a Consumer* using RecvTransport::Consume();
3 Use Consumer::GetTrack() to get a webrtc::AudioTrackInterface* object;
4 Use webrtc::AudioSourceInterface::GetSource() to get a webrtc::AudioSourceInterface* object;
5 Register an AudioSourceInterface::AudioObserver with webrtc::AudioSourceInterface::RegisterAudioObserver();

When I connect to mediasoup-demo, I am able to receive the sound of the remote browser endpoint, but AudioSourceInterface::AudioObserver::OnSetVolume() is not called.

Is there any advice?

Or use another method to get the volume?

In addition, how does libmediasoupclient use mediasoup::AudioLevelObserver?

Interesting question, but no idea honestly. libmediasoupclient provides you with remote tracks and, by using the libwebrtc API (as you are doing), you should be able to get audio volume, etc. No idea why it does not work and no idea how should it be used.

I hope others can help here.

libmediasoup does not use any mediasoup::AudioLevelObserver. It’s mediasoup server the one who has that and it’s based on ‘urn:ietf:params:rtp-hdrext:ssrc-audio-level’ RTP header extension.

Thank you!