上次写了一个rtsp协议分解,把rtsp得各个部分分解开来放入到map中,发现了一些错误。 如下字符
string strlines =
"OPTIONS rtsp ://192.168.0.129:8554 RTSP/1.0\r\n"
"CSeq: 1\r\n"
"User - Agent : RealMedia Player Version 6.0.9.1235 (linux - 2.0 - libc6 - i386 - gcc2.95)\r\n"
"ClientChallenge : 9e26d33f2984236010ef6253fb1887f7\r\n"
"PlayerStarttime : [28 / 03 / 2003:22 : 50 : 23 00 : 00]\r\n"
"CompanyID : KnKV4M4I / B2FjJ1TToLycw ==\r\n"
"GUID : 00000000 - 0000 - 0000 - 0000 - 000000000000\r\n"
"RegionData : 0\r\n"
"ClientID : Linux_2.4_6.0.9.1235_play32_RN01_EN_586\r\n\r\n";
使用 fetch_head_info_rtsp函数出错,原因是rtsp 协议options 中请求无路由 如果是rtsp 😕/192.168.0.129:8554/live/1001 则没有错误,ok,修正这个错误,代码如下:
//适应rtsp协议
static int fetch_head_info_rtsp(std::string &lines, c_header_map &hmap)
{
//we analyse the string like this:
//OPTIONS rtsp://ip/live/1001 rtsp/1.0
std::istringstream s(lines);
std::string request;
std::getline(s, request);
size_t len = request.size();
if (request[len - 1] != '\r')
{
//please use log instead of cout,of course ,now we just cout
std::cout
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?