Live555源码分析@njzhujinhua[3]:ServerMediaSubsession与ServerMediaSession
来源:互联网 发布:淘宝包包代理厂家直销 编辑:程序博客网 时间:2024/04/29 15:15
[1]ServerMediaSubsession与ServerMediaSession
两者均继承自Medium,但他们的作用却不是像其名字般看上去是继承关系。
两者均可预先建立,也可在收到describe命令时根据请求而去查找文件并建立。在目前分析的testOnDemandRTSPServer.cpp中是启动时即预先建立的,如下
而在live555MediaServer.exe的程序实现则是通过DynamicRTSPServer::lookupServerMediaSession时若文件存在且SMS尚不存在时进行新建。本质大同小异。
看一下两个类的类图:
[2]ServerMediaSubsession的实现
该类定义为抽象类. 在Live555源码分析[1]:RTSPServer中有一副图提到过其具体子类的派生关系。如下是H264VideoFileServerMediaSubsession的一种
两者均继承自Medium,但他们的作用却不是像其名字般看上去是继承关系。
两者均可预先建立,也可在收到describe命令时根据请求而去查找文件并建立。在目前分析的testOnDemandRTSPServer.cpp中是启动时即预先建立的,如下
char const* streamName = "h264ESVideoTest"; char const* inputFileName = "test.264"; ServerMediaSession* sms = ServerMediaSession::createNew(*env, streamName, streamName, descriptionString); sms->addSubsession(H264VideoFileServerMediaSubsession ::createNew(*env, inputFileName, reuseFirstSource)); rtspServer->addServerMediaSession(sms); announceStream(rtspServer, sms, streamName, inputFileName);
而在live555MediaServer.exe的程序实现则是通过DynamicRTSPServer::lookupServerMediaSession时若文件存在且SMS尚不存在时进行新建。本质大同小异。
看一下两个类的类图:
注意箭头所示。
class ServerMediaSession: public Medium {//精简版public: char* generateSDPDescription(); // based on the entire session // Note: The caller is responsible for freeing the returned string Boolean addSubsession(ServerMediaSubsession* subsession); unsigned numSubsessions() const { return fSubsessionCounter; } void deleteAllSubsessions(); // Removes and deletes all subsessions added by "addSubsession()", returning us to an 'empty' state // Note: If you have already added this "ServerMediaSession" to a "RTSPServer" then, before calling this function, // you must first close any client connections that use it, // by calling "RTSPServer::closeAllClientSessionsForServerMediaSession()".private: // Linkage fields: friend class ServerMediaSubsessionIterator; ServerMediaSubsession* fSubsessionsHead; ServerMediaSubsession* fSubsessionsTail; unsigned fSubsessionCounter; char* fStreamName; char* fInfoSDPString; char* fDescriptionSDPString; char* fMiscSDPLines; struct timeval fCreationTime; unsigned fReferenceCount; Boolean fDeleteWhenUnreferenced;};即可明白其主要维护的是一个流的描述信息, 及管理多个ServerMediaSubsession.
对于文件存储来说, 其对应于该文件信息, 而ServerMediaSubsession则对应于该媒体文件的多个track, 且由ServerMediaSession管理.
代码中另一个看上去与Session有关的类RTSPClientSession则是与每个客户的rtsp连接相关联的。
[2]ServerMediaSubsession的实现
该类定义为抽象类. 在Live555源码分析[1]:RTSPServer中有一副图提到过其具体子类的派生关系。如下是H264VideoFileServerMediaSubsession的一种
先休息,后面继续针对OnDemandServerMediaSubsession等展开讨论下sdp的生成等细节
0 0
- Live555源码分析@njzhujinhua[3]:ServerMediaSubsession与ServerMediaSession
- live555 源码分析:ServerMediaSession
- Live555源码分析@njzhujinhua[1]:RTSPServer
- Live555源码分析@njzhujinhua[4]:generateSDPDescription
- Live555源码分析@njzhujinhua[2]:RTSPServer中的用户认证
- 【live555】ServerMediaSubsession具体与流有关的操作和参数
- live555 源码分析
- live555 源码架构分析
- Live555源码分析:generateSDPDescription
- live555 源码分析:简介
- live555 源码分析:基础设施
- live555 源码分析:MediaSever
- live555 源码分析:RTSPServer
- Live555源码分析
- live555 源码分析:简介
- live555源码分析-live555大致流程
- live555源码分析-live555大致流程
- live555源码分析----RTP的打包与发送
- java 二维数组,三维数组 ,糊糙数组,多维数组示例代码
- 网络概述
- java多线程之路之线程状态—Core Java学习
- pvr查看工具 windows 下预览
- 基础系统数据录入有感
- Live555源码分析@njzhujinhua[3]:ServerMediaSubsession与ServerMediaSession
- Linux服务器之平均负载
- JavaScript 的作用域问题
- string和stringbuilder的区别
- 1网络接口层
- 设计模式备忘
- 《硝烟中的scrum和xp》读书笔记
- Go 1.3 Beta1 发布,支持谷歌 NaCL、编译更快
- ArrayBlockingQueueDemo