将音频流式传输到 Android 电话 [英] Stream audio to a phone call Android

查看:43
本文介绍了将音频流式传输到 Android 电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 Android 上的电话发送音频流.

例如,创建一个应用来播放一些自定义的保持音乐,或者接听电话并播放录音/音频文件.我知道可以让应用自动接听电话,但它可以向来电者发送音频吗?

如果可能,请让我知道哪些类/函数处理这个问题.

解决方案

写入电话流是可能的,但不能从普通(非 root)手机上的应用程序级别写入.

>

当发起电话呼叫时,麦克风通常"(实际上取决于特定电话)直接路由到基带,即完全跳过主处理器.

对于输出音频:mic->codec->baseband对于传入的音频:基带->编解码器->扬声器

如果一直路由:mic->codec->mainprocessor->codec->baseband

如果 Android API(框架)支持访问它,那么流将可能"可用.

我说这是可能的原因是因为音频(现在几乎所有智能手机)都是通过 SlimBus 连接的允许动态改变音频路径.然而,它是通过位于 ALSA 中的编解码器驱动程序在内核中完成的.

所以.... 如果你有动力,你可以获取手机 Linux 内核的源代码并修改编解码器/ALSA 驱动程序,以允许你更改设置呼叫音频路径时发生的情况.

当然,新路径会导致延迟,打破 AT&T 设置的呼叫/延迟标准(Audience 帮助他们编写...)并且基带芯片可能会拒绝您的音频,因为它不及时.

最后,您需要修改 Android 源(框架)以扩展 API 以支持将音频注入该流.(您需要为 mediaserver 制作大型模组,尤其是 audioflinger...)

这很复杂,但有你的答案.干杯,:-)

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.

解决方案

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.

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

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

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

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.

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.

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.

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, :-)

这篇关于将音频流式传输到 Android 电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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