从 Google Meet 获取音频会话 ID [英] Get Audio Session Id from Google Meet

查看:24
本文介绍了从 Google Meet 获取音频会话 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩 DynamicsProcessing.我想处理来自外部应用程序的音频.为此,我只需要 audioSessionId.例如,我对 播放音乐 没有任何问题.我使用了 BroadCastReceiver 收听 android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION 并且一切正常.

I am playing with DynamicsProcessing. I want to process the audio from an external application. I just require the audioSessionId for that. I have no problems with Play Music, for example. I have used a BroadCastReceiver listening the android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION and everything works like a charm.

<receiver android:name=".framework.AudioSessionReceiver">
    <intent-filter>
        <action android:name="android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION"/>
    </intent-filter>
</receiver>

class AudioSessionReceiver : BroadcastReceiver() {

    override fun onReceive(context: Context?, intent: Intent?) {
        intent?.let {
            val audioSessionId = intent.getIntExtra(Equalizer.EXTRA_AUDIO_SESSION, -1)
            val packageName = intent.getStringExtra(Equalizer.EXTRA_PACKAGE_NAME)
            KLog.i("audioSessionId: $audioSessionId")
            KLog.i("packageName: $packageName")
        } ?: KLog.w("Intent is null")
    }
}

挑战在于我想用 Google Meet 做同样的事情.我不知道如何从应用程序中获取会话 ID.但我知道这是可能的,因为如果我在 Logcat 上寻找它,我可以直接看到它:

The challenge is when I want to do the same with Google Meet. I do not know how to get the session id from the app. But I know it is possible because I can see it directly if I look for it on Logcat:

WebRtcAudioTrackExternal: [623:191] [21746] AudioTrack: session ID: 7649, channels: 1, sample rate: 48000, max gain: 1.0

如果我手动传递 session ID (audioSessionId),我已经检查过它是否有效.

And I have checked it works if I pass the session ID (audioSessionId) manually.

如何从应用中执行此操作?

非常感谢!!:-)

推荐答案

可以从活动的 AudioRecordaudioSessionId 中获取,因为它是在 AudioRecord 之后创建的code>AudioTrack 创建和数字从 8 到 8.

It can be obtained from the audioSessionId of the active AudioRecord because it is created just after the AudioTrack creation and the numbers go from 8 to 8.

val audioManager = (context.getSystemService(Context.AUDIO_SERVICE) as AudioManager)
return audioManager.activeRecordingConfigurations[0].clientAudioSessionId - 8

我已经在使用 Google Meet 进行视频会议时检查过它并平衡了其他人的声音.;-)

I have checked it doing a video conference with Google Meet and equalize the voice from the other person. ;-)

https://github.com/soygabimoreno/AudioClean

这篇关于从 Google Meet 获取音频会话 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆