当前位置:网站首页>mediaserver创建
mediaserver创建
2022-08-10 03:12:00 【木希】
在前面我们说过安卓的开机流程,在内核初始化完成后,init 进程创建后会根据/system/etc/init 目录下的.rc文件进行创建服务,今天介绍下mediaserver的创建,跟实现的对应的功能。
我们先看看framework/av/media/mediaserver/mediaserver.rc,这个很简单就起mediaserver
on property:init.svc.media=*
setprop init.svc.mediadrm ${init.svc.media}
service media /system/bin/mediaserver
class main
user media
group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm
ioprio rt 4
task_profiles ProcessCapacityHigh HighPerformance
服务。看看mediaserver的main函数framework/av/media/mediaserver/main_mediaserver.cpp
int main(int argc __unused, char **argv __unused)
{
signal(SIGPIPE, SIG_IGN);
//打开/dev/binder设备,得到binder设备的fd
//将bidner设备fd映射到当前进程虚拟地址空间建立交互的通道;
sp<ProcessState> proc(ProcessState::self());
///获取ServiceManager的代理对象
sp<IServiceManager> sm(defaultServiceManager());
ALOGI("ServiceManager: %p", sm.get());
//将MediaPlayerService加入到ServiceManager中,BpServiceManager的AddService将数据写入到
//Binder设备传递给ServiceManager。
MediaPlayerService::instantiate();
ResourceManagerService::instantiate();
registerExtensions();
::android::hardware::configureRpcThreadpool(16, false);
//启动进程的线程池
ProcessState::self()->startThreadPool();
//执行线程消息循环
IPCThreadState::self()->joinThreadPool();
::android::hardware::joinRpcThreadpool();
}
这里mediaserver服务器就起来了,等待mediaplayer 同mediaserver的通信。
安卓mediaplayer的启动会比较简单MediaPlayer.java 提供API接口---> android_media_MediaPlayer.cpp对应jni接口--->MediaPlayer.cpp调用MediaPlayerService接口,创建binder client 同MediaPlayerService 进行消息交互。
边栏推荐
猜你喜欢
js原型和原型链以及原型继承
How to write a high-quality test case?
金融口译,口译中金融高频词有哪些
Recommend several easy-to-use MySQL open source clients, it is recommended to collect
Did not detect default resource location for test class xxxx
Evaluation and Construction of Enterprise Network Security Capability from the Sliding Ruler Model
ARP欺骗-教程详解
黑马jvm课程笔记d2
liunx PS1 settings
Dijkstra求最短路
随机推荐
NFG电商系统在元宇宙趋势下做什么?
一文教会你快速上手 Vim
WPF 实现更换主题色
flutter 创建可增型列表和列表排序
No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
新零售社交电商APP系统平台如何打造公域+私域流量?
如何快速成为一名软件测试工程师?测试员月薪15k需要什么技术?
盘式导电滑环的优点和缺点
使用curl指令发起websocket请求
PC摄像头设置 默认摄像头设置 win11 默认摄像头设置
第三章 搜索与图论(二)
fastjson autoType is not support
Pen paper records
ES高亮显示语法
C - The Battle of Chibi (dp加树状数组前缀和优化)
excel高级绘图技巧100讲(二十三)-Excel中实现倒计时计数
论文理解:“PIAT: Physics Informed Adversarial Training for Solving Partial Differential Equations“
exchange2010 邮件数据库无法装入
Example 046: Breaking the Cycle
电子产品结构设计中的电磁兼容性(EMC)设计