Android源和AudioRecord多利用 [英] Android source and AudioRecord multi-utilisation

查看:1107
本文介绍了Android源和AudioRecord多利用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在构建一个Android定制ROM,这将通过语音来控制,只有:

I'm currently building an android custom rom, which will be only controlled by voice: So I came across this portion of code in the android source :

// refuse 2 active AudioRecord clients at the same time except if the active input                         
// uses AUDIO_SOURCE_HOTWORD in which case it is closed.

在<一个href=\"https://android.googlesource.com/platform/hardware/libhardware_legacy/+/master/audio/AudioPolicyManagerBase.cpp\" rel=\"nofollow\">https://android.googlesource.com/platform/hardware/libhardware_legacy/+/master/audio/AudioPolicyManagerBase.cpp行997

我想知道,为了这个目的,它的完成?硬件的限制?

I would like to know for which purpose it's done? hardware limitation?

推荐答案

在再现的情况下,多个并发客户端写入到相同的输出通过混合,这是在libaudioflinger实施中进行处理。

In a playback scenario, multiple concurrent clients writing to the same output are handled by means of mixing, which is implemented in libaudioflinger.

要处理多个并发客户端在录音场景你需要某种形式的分流器是需要消耗从驱动未来音频缓冲,并将其输送到所有客户端的照顾,并且可能执行重采样,单声道/立体声转换,等香草的Andr​​oid实现根本没有一个分流器(不是最后一次我看了反正)。结果当我曾在索尼,我们使用一个专有的分流器上的几部电话(了Xperia P,U,和独奏,IIRC),这使我们能够支持多种录音的客户。所以这是可以做到的,但它不是小事。

To handle multiple concurrent clients in a recording scenario you'd need some sort of stream splitter that takes care of consuming audio buffers coming from the driver and feeding them to all the clients, and possibly perform resampling, mono/stereo conversion, etc. A vanilla Android implementation simply doesn't have a stream splitter (not the last time I looked anyway).
When I worked at Sony we used a proprietary stream splitter on a few phones (the Xperia P, U, and Solo, IIRC), which allowed us to support multiple recording clients. So it is possible to do, but it's not trivial.

这篇关于Android源和AudioRecord多利用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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