您当前的位置: 首页 > 

qianbo_insist

暂无认证

  • 0浏览

    0关注

    399博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

rtsp协议分解函数修订

qianbo_insist 发布时间:2022-06-06 14:38:34 ,浏览量:0

上次写了一个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             
关注
打赏
1663161521
查看更多评论
0.0354s