博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android webrtc使用opensl es
阅读量:7076 次
发布时间:2019-06-28

本文共 1571 字,大约阅读时间需要 5 分钟。

1. java层开启开关

peerConnectionParameters =        new PeerConnectionClient.PeerConnectionParameters();

接口中的useOpensles参数设置为true

2. /system/etc/permissions/下新增android.hardware.audio.low_latency.xml文件,内容如下:

< ?xml version="1.0" encoding="utf-8"?> 

ps:webrtc创建不同的音频播放方式源码代码如下:

audio_device_imp.cc文件  int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects()接口

if (audioLayer == kPlatformDefaultAudio) {    if (_audioManagerAndroid->IsLowLatencyPlayoutSupported() &&        _audioManagerAndroid->IsLowLatencyRecordSupported()) {      // Use OpenSL ES for both playout and recording.      audioLayer = kAndroidOpenSLESAudio;    } else if (_audioManagerAndroid->IsLowLatencyPlayoutSupported() &&               !_audioManagerAndroid->IsLowLatencyRecordSupported()) {      // Use OpenSL ES for output on devices that only supports the      // low-latency output audio path.      audioLayer = kAndroidJavaInputAndOpenSLESOutputAudio;    } else {      // Use Java-based audio in both directions when low-latency output is      // not supported.      audioLayer = kAndroidJavaAudio;    }  }

判断条件源码在audio_manager.cc

bool AudioManager::IsLowLatencyPlayoutSupported() const {  RTC_DCHECK(thread_checker_.CalledOnValidThread());  ALOGD("IsLowLatencyPlayoutSupported()");  // Some devices are blacklisted for usage of OpenSL ES even if they report  // that low-latency playout is supported. See b/21485703 for details.  return j_audio_manager_->IsDeviceBlacklistedForOpenSLESUsage() ?      false : low_latency_playout_;}

转载于:https://my.oschina.net/xgcode/blog/2209073

你可能感兴趣的文章
美光Sun合作长寿命SLC闪存 100万次写入
查看>>
OCZ新Summit系列固态硬盘强悍性能曝光
查看>>
视频|每日CeBIT总结:中国元素充斥 多元化工业展也Fashion
查看>>
《中国人工智能学会通讯》——1.44 到底什么是虹膜识别
查看>>
存储“芯”突破口 解析3D NADN产业竞争形势
查看>>
用MAID 2.0降低存储费用
查看>>
积极推动中国金融资产市场化流动
查看>>
《中国人工智能学会通讯》——2.15 手术机器人
查看>>
旗舰店揭幕大疆无人机用阿里云全球直播
查看>>
客观看待社保系统管理漏洞
查看>>
【转载】Docker 镜像优化与最佳实践
查看>>
Kepler452b被发现 那么房价缩水究竟有没有指望?
查看>>
向亲戚朋友解释系列之什么是IP,端口和域名
查看>>
高危预警!移动设备安全面临的5大新型威胁
查看>>
Linux中如何查看显卡硬件信息
查看>>
如何在Linux上检测硬盘上的坏道和坏块
查看>>
网络架构之路(一):目标
查看>>
低功耗M2M市场广阔 芯片设计如何降耗
查看>>
软件定义技术存在哪些限制?
查看>>
拨开数据迷雾:如何理清大数据脉络?
查看>>