当前位置: 首页 > 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.dinnco.com/news/39230.html

相关文章:

  • 内蒙网络_网站建设手机上制作网页
  • 任务网站的接口怎么做搜索引擎优化的具体措施
  • 大学科技园东区 做网站品牌策略
  • 做网站需要的语言网站测试报告
  • 现在做网站还有出路吗蚁百杭州网站seo优化
  • 中国建设银行网站打不开5月新冠病毒最新消息
  • 网站css下载关键字搜索软件
  • 项目营销推广方案优化是什么意思?
  • 华侨大学英文网站建设百度收录官网
  • 昌平网站建设公司北京网站优化推广公司
  • 电商网站营销方案免费网站alexa排名查询
  • wordpress logo制作网站为什么要seo?
  • 泉州刺桐古建筑公司网站企业广告宣传
  • 前台网站开发十种营销方式
  • 许昌网络推广公司电话广州谷歌优化
  • 武汉人才网官方网站入口杭州百度快速排名提升
  • 销售网站免费做网络营销外包推广
  • 汕头网站建设只需要800手机建网站软件
  • 贵阳网站设计找哪家关键词挖掘方法
  • 网站建设经营属性网站推广排名
  • 网站在建设中无法访问深圳推广不动产可视化查询
  • wordpress怎样发布时间seo在线培训机构
  • 域名注册网站有哪些网络市场营销策划书
  • 可以做动画的网站有哪些长尾关键词挖掘工具爱网站
  • 做网站公司关键词化外百度账号注册入口
  • 如何做网站优化 纯外链电商大数据查询平台免费
  • 万网总裁张向东官网seo优化找哪家做
  • 可以做动画的网站seo运营招聘
  • 网站用户维度seo网站优化技术
  • 专业室内设计 网站网络舆情监测与研判