流音频电话安卓流音、电话

2023-09-12 01:22:13 作者:初心✿

我试图发送一个音频流出来了一个电话,在Android上。

I am attempting to send an audio stream out over a phone call on Android.

例如,创建一个应用程序,它会播放一些自定义的保持音乐,或接听电话,并播放录音/音频文件。我知道这是可能有一个应用程序将自动接听电话,但可以将它发送音频给呼叫者?

For example, to create an app which would play some custom on-hold music, or answer a call and play a recording/audio file. I know it is possible to have an app automatically answer a call, but can it send audio to the caller?

如果有可能,请让我知道什么是类/函数处理这个问题。

If it is possible, please let me know what classes/functions handle this.

谢谢!

推荐答案

写的电话,流的是的可能,但不能从对A股(非根)手机的应用水平。

Writing to the phone call stream IS possible, but not from the app level on a stock (non rooted) phone.

在发起电话呼叫话筒是典型的(实际上取决于特定的手机上)直接路由到基带,即完全跳过主处理器。

When a phone call is initiated the mic is "typically" (really depends on the specific phone) routed directly to the baseband, ie skipping the main processor altogether.

有关输出音频:麦克风 - > codeC->基带处理 对于输入的音频信号:基带 - > codeC->音箱

For outgoing audio: mic->codec->baseband For incoming audio: baseband->codec->speaker

如果它总是被排到:麦克 - > codeC-> mainprocessor ​​ - > codeC->基带

If it were always routed: mic->codec->mainprocessor->codec->baseband

,则该流将是presumably如果可以在Android的API(框架)的支持访问它。

Then the stream would be "presumably" available if the Android APIs (frameworks) supported accessing it.

我说这是有可能的原因是因为音频(几乎所有的智能手机现在)是通过称为SLIMbus连接这使得音频路径的动态变化。然而在内核中通过codeC司机生活在 ALSA

The reason I say it is possible is because the audio (for nearly all smartphones now) is connected via SlimBus This allows dynamic changing of audio paths. It is however done in the kernel via the codec driver living in ALSA.

所以....是你这样的动机,你可以得到源代码Linux内核的手机和修改codeC / ALSA驱动程序允许您更改时会发生什么呼叫音频路径设置。

So.... were you so motivated, you could get the source for the Linux kernel for a phone and modify the codec/ALSA driver to allow you to change what happens when the call audio path is setup.

当然,那么你会产生延迟的新路,打破了呼叫/延迟标准的AT&放大器;:T设置(即观众帮他们写...)和基带芯片可能会拒绝你的声音,因为它不是及时

Of course then you would incur latency with the new path, breaking the call/latency standards AT&T setup (that Audience helped them write...) and the baseband chip might reject your audio as it's not timely.

最后,你需要修改Android源(框架)发展壮大的API,支持音频注入到该流。 (你需要做出重大器官功能障碍综合征的MediaServer,audioflinger尤其是...)

Lastly you would need to modify the Android source (frameworks) to grow the API to support injecting audio onto that stream. (You'd need to make big mods to mediaserver, audioflinger in particular...)

这是复杂的,但你的答案。干杯,: - )

It's complicated, but there is your answer. Cheers, :-)

 
精彩推荐
图片推荐