live555源码初步解析(一)
来源:互联网 发布:什么是php-fpm 编辑:程序博客网 时间:2024/05/29 16:04
最近因项目需要,要学习live555这个开源平台。live555是用c++实现的,对于该平台的介绍网上有很多文章,以下是个人在读它源码时的记录,也是一个初步的理解,和大家一起分享一下。有错误,或者不足之处请大家指出。
BasicUsageEnvironment库
a) BasicHashTable.cpp
1. BasicHashTable类
功能: 一个简单的hash表的实现
SMALL_HASH_TABLE_SIZE=4
构造函数BasicHashTable(int keyType),传入参数键的类型
Add(char const* key, void* value) 增加一对键值 注:void* 指针,它可以保存任何类型对象的地址
Remove(char const* key) 根据键删除一个键值对
Lookup(char const* key) 根据键查询键值
NumEntries() 返回实体数目
HashTable* create(int keyType) hash表的创建
Iterator* create(HashTable& hashTable) 返回hash表的迭代器
b) HandlerSet.hh (handlerSet 的定义)
1. HandlerDescriptor类,句柄描述符
int socketNum //socket数量
BackgroundHandlerProc* handlerProc //句柄后台处理的进程指针
void* clientData //客户端数据指针
2. HandlerSet类,句柄的集合
assignHandler(int socketNum,TaskScheduler::BackgroundHandlerProc* handlerProc, void* clientData); //分配句柄
removeHandler(int socketNum); //根据socket号删除句柄
3. HandlerIterator类,句柄迭代器
HandlerDescriptor* next(); //下一个句柄,没有则返回NULL
reset();
c) DelayQueue.hh
1. DelayQueueEntry类,延迟队列实体
long token(); //????
2. DelyQueue类,延迟队列
addEntry(DelayQueueEntry* newEntry); //return a token for the entry
updateEntry(DelayQueueEntry* entry, DelayInterval newDelay);
updateEntry( long tokenToFind, DelayInterval newDelay);
removeEntry() //移除实体,但是不删除
DelayInterval const& timeToNextAlarm();
handleAlarm();
d) UsageEnvironment.hh
1. UsageEnvironment类,这是一个抽象的基类
void reclaim();//回收,当没有剩余的状态时,删除自己
taskScheduler() //任务调度程序
//结果信息的处理
getResultMsg();
setResultMsg();
setResultErrMsg();
appendToResultMsg(); //like setResultMsg(), except that an 'errno' message is appended
reportBackgroundError();//用于报告后台预先设置的错误的信息
getErrno(); // ‘errno’
UsageEnvironment& operator<<(); //console output
2. TaskScheduler类,任务调度类,是一个抽象的基类
virtual TaskToken scheduleDelayedTask(nt64_t microseconds, TaskFunc* proc,void* clientData) //当我们下一个达到调度点的,调度一个任务(在一个延迟之后)。(Does not delay, if “microseconds”<=0,)。返回一个token,可用于以后的unscheduleDelayTask()的调用。
virtual void unscheduleDelayedTask(TaskToken& prevTask); //设置”prevTask”=NULL(如果prevTask==NULL,no effect)
virtual void rescheduleDelayedTask() // Combines "unscheduleDelayedTask()" with "scheduleDelayedTask()" (setting "task" to the new task token).
typedef void BackgroundHandlerProc(void* clientData, int mask); // handing sockets reads in the background
virtual void turnOnBackgroundReadHandling () //打开后台socket读取
virtual void turnOffBackgroundReadHandling () //关闭后台socket读取
virtual void doEventLoop(char* watchVariable = NULL) // Stops the current thread of control from proceeding, but allows delayed tasks (and/or background I/O handling) to proceed.(If "watchVariable" is not NULL, then we return from this routine when *watchVariable != 0)
- live555源码初步解析(一)
- live555源码初步解析(一)
- live555源码阅读(一)
- Live555源码解析(1)
- Live555源码解析(2)
- Live555源码解析(3)
- live555源码阅读一
- live555 源码解析 --H264VideoStreamParser 详解
- live555 服务端源码分析一
- mybatis源码初步解析
- Servlet源码解析初步
- live555笔记(一)
- Oracle bitmap 初步解析(一)
- LIVE555源码研究之四:MediaServer (一)
- LIVE555源码研究之四:MediaServer (一)
- LIVE555源码研究之四:MediaServer (一)
- LIVE555源码研究之四:MediaServer (一)
- Irrlicht源码解析(一)
- 常用css总结
- 丢城逃跑
- Features 和 Selections
- 鼠标移出时隐藏 DIV 的问题
- 第四部分 服务器的工作模式
- live555源码初步解析(一)
- Java或Web中解决所有路径问题
- Lesson 4
- brew音量调节
- Lesson 5
- Cover Letter & Resume 重点诠释 - 深度剖析
- 分享一个本学期的组内报告(Topology Calculation and Tuning)
- Winfrom 中 ListBox如何实现上移下移,置顶 置底的功能
- 创建修改otr的tcode