当前位置: 首页 > news >正文

宁波网站建设公司哪家最正规免费建自己的网站

宁波网站建设公司哪家最正规,免费建自己的网站,今日国际新闻最新消息事件,中信建设有限责任公司江苏分公司企查查Android 系统播放声音,需要创建AudioTrack来和AudioFlinger通信,其创建过程如下 根据传入的声音属性得到output通过得到的output,找到播放线程AudioFlinger在播放线程内,创建Track,和AudioTrack对应。后续通过它们进…

Android 系统播放声音,需要创建AudioTrack来和AudioFlinger通信,其创建过程如下
在这里插入图片描述

  1. 根据传入的声音属性得到output
  2. 通过得到的output,找到播放线程
  3. AudioFlinger在播放线程内,创建Track,和AudioTrack对应。后续通过它们进行通信

接下来分别看下其过程

找到output
在getOutputForAttr函数内,直接调用getOutputForAttrInt函数

//frameworks/av/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
status_t AudioPolicyManager::getOutputForAttrInt(audio_attributes_t *resultAttr,audio_io_handle_t *output,audio_session_t session,const audio_attributes_t *attr,audio_stream_type_t *stream,uid_t uid,const audio_config_t *config,audio_output_flags_t *flags,audio_port_handle_t *selectedDeviceId,bool *isRequestedDeviceForExclusiveUse,std::vector<sp<AudioPolicyMix>> *secondaryMixes,output_type_t *outputType)
{DeviceVector outputDevices;const audio_port_handle_t requestedPortId = *selectedDeviceId;DeviceVector msdDevices = getMsdAudioOutDevices();const sp<DeviceDescriptor> requestedDevice =mAvailableOutputDevices.getDeviceFromId(requestedPortId);*outputType = API_OUTPUT_INVALID;status_t status = getAudioAttributes(resultAttr, attr, *stream);//将attr赋值给resultAttr//省略outputDevices = mEngine->getOutputDevicesForAttributes(*resultAttr, requestedDevice, false);//根据resultAttr,找到device//省略if (*output == AUDIO_IO_HANDLE_NONE) {*output = getOutputForDevices(outputDevices, session, *stream, config,flags, resultAttr->flags & AUDIO_FLAG_MUTE_HAPTIC);//根据device,找到output}//省略
}

1,找到device

//frameworks/av/services/audiopolicy/enginedefault/src/Engine.cpp
DeviceVector Engine::getOutputDevicesForAttributes(const audio_attributes_t &attributes,const sp<DeviceDescriptor> &preferredDevice,bool fromCache) const
{product_strategy_t strategy = getProductStrategyForAttributes(attributes);//省略return fromCache? mDevicesForStrategies.at(strategy) : getDevicesForProductStrategy(strategy);
}

首先,通过声音属性,从mProductStrategies中找到strategy,然后根据strategy,找到对应的device。getDevicesForProductStrategy这个函数由厂商自定义,修改声音的音频策略,大多数情况下可以修改这个函数。

2,根据device,找到output

//frameworks/av/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
audio_io_handle_t AudioPolicyManager::getOutputForDevices(const DeviceVector &devices,audio_session_t session,audio_stream_type_t stream,const audio_config_t *config,audio_output_flags_t *flags,bool forceMutingHaptic)
{//省略if (audio_is_linear_pcm(config->format)) {SortedVector<audio_io_handle_t> outputs = getOutputsForDevices(devices, mOutputs);*flags = (audio_output_flags_t)(*flags & ~AUDIO_OUTPUT_FLAG_DIRECT);output = selectOutput(outputs, *flags, config->format, channelMask, config->sample_rate);}return output;}

mOutputs中,支持该device的output可能有多个,通过getOutputsForDevices把它们找出来,然后调用selectOutput从中选择一个最符合的。怎么从中找到最合适的output,可以看其注释

	// select one output among several that provide a path to a particular device or set of// devices (the list was previously build by getOutputsForDevices()).// The priority is as follows:// 1: the output supporting haptic playback when requesting haptic playback// 2: the output with the highest number of requested functional flags// 3: the output supporting the exact channel mask// 4: the output with a higher channel count than requested// 5: the output with a higher sampling rate than requested// 6: the output with the highest number of requested performance flags// 7: the output with the bit depth the closest to the requested one// 8: the primary output// 9: the first output in the list

综上,找到output的流程为: audio_attributes_t >>> strategy >>> device >>> output

找到播放线程

AudioFlinger::PlaybackThread *AudioFlinger::checkPlaybackThread_l(audio_io_handle_t output) const
{return mPlaybackThreads.valueFor(output).get();
}

根据output,从mPlaybackThreads中找到对应的播放线程

创建Track

//frameworks/av/services/audioflinger/Threads.cpp
sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrack_l(/*省略*/)
{//省略track = new Track(this, client, streamType, attr, sampleRate, format,channelMask, frameCount,nullptr /* buffer */, (size_t)0 /* bufferSize */, sharedBuffer,sessionId, creatorPid, uid, *flags, TrackBase::TYPE_DEFAULT, portId,SIZE_MAX /*frameCountToBeReady*/, opPackageName);//省略mTracks.add(track);//省略
}

AudioFlinger的PlaybackThread中有一个mTracks数组,先创建Track,然后将该Track保存到mTracks中。

总结
应用程序创建AudioTrack,导致在对应的播放线程内,创建Track和其对应。如何找到对应的播放线程?

  1. 根据传入的声音属性,找到strategy
  2. 根据strategy ,找到device
  3. 根据device找到output
  4. 根据output,从mPlaybackThreads中找到对应的播放线程
http://www.hkea.cn/news/182907/

相关文章:

  • css做网站常用百度权重优化软件
  • 合合肥网站建设制作网站用什么软件
  • 杭州网站设计公司推荐网络推广与优化
  • 移动惠生活app下载网址荆门网站seo
  • 做网站很赚钱吗关键词自助优化
  • wordpress小工具里的用户中心南京谷歌优化
  • 网站开发中茶叶网络营销策划方案
  • 临海市住房与城乡建设规划局 网站目前最新的营销模式有哪些
  • 高校建设网站的特色如何建立一个网站
  • 公司做网站域名归谁搜索引擎营销策划方案
  • 怎么做外贸个人网站seo综合查询工具可以查看哪些数据
  • 黑客网站盗qq百度seo公司整站优化
  • 网页设计代码不能运行seo的中文名是什么
  • 灵溪网站建设外贸网站谷歌seo
  • 网站开发系统设计产品推销
  • 不用代码做网站 知乎百度引流推广怎么收费
  • 怎么看网站后台什么语言做的产品全网营销推广
  • 可以做宣传图的网站网络销售管理条例
  • 做书籍封皮的网站制作网站平台
  • 1网站建设公司长沙网站到首页排名
  • 域名还在备案可以做网站吗seo培训班
  • 前程无忧网宁波网站建设类岗位北京网站快速排名优化
  • 如何优化网站内部链接站长工具站长之家
  • 阿里云网站建设的实训报告免费的自媒体一键发布平台
  • 关于加强网站建设的意见企业获客方式
  • 帮企业建设网站保密合同优化设计电子课本
  • 金山石化网站建设广告电话
  • 网站开发 前景网络推广代理
  • 温州整站推广咨询seo网站推广专员
  • 企业营销型网站团队百度seo排名优化教程