使用libcurl v7.43.0的Axis相机上的RTSP description返回RTSP错误码400
RTSP DESCRIBE on Axis Camera with libcurl v7.43.0 returns RTSP errorcode 400
我得到一个HTTP错误400响应以下RTSP URL正在处理的函数如下所示。
description rtsp://root:pass@192.168.1.47/axis-media/media.amp ?videocodec=h264/
我使用的IP摄像机是最新的AXIS H264摄像机。
我使用的libcurl版本是v7.43.0
bool CHttpClientCurl: Get (){//初始化curlCURLcode res = CURLE_OK;if (m_curl == NULL){m_sError = L"CURL句柄为NULL ";返回错误;}
m_sBuffer.clear();
// initialize this curl session
curl_easy_reset(m_curl);
char sUrl[8192];
wcstombs(sUrl, m_sUrl.c_str(), m_sUrl.length());
sUrl[m_sUrl.length()] = ' ';
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
printf(" cURL V%s loadedn", data->version);
if (m_curl != NULL) {
curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(m_curl, CURLOPT_PROTOCOLS, CURLPROTO_RTSP);
res = curl_easy_setopt(m_curl, CURLOPT_URL, sUrl);
// request server options
printf("nRTSP: OPTIONS %sn", sUrl);
curl_easy_setopt(m_curl, CURLOPT_PROTOCOLS, CURLPROTO_RTSP);
res = curl_easy_setopt(m_curl, CURLOPT_RTSP_STREAM_URI, sUrl);
curl_easy_setopt(m_curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE);
curl_easy_setopt(m_curl, CURLOPT_RTSP_TRANSPORT, "RTP/AVP;unicast;client_port=64378-64379");
// curl_easy_setopt(m_curl, CURLOPT_RTSP_SESSION_ID, "56789");
res = curl_easy_perform(m_curl);
int64_t nHttpCode = 0;
curl_easy_getinfo(m_curl, CURLINFO_RESPONSE_CODE, &nHttpCode);
m_nStatusCode = nHttpCode;
if (res != CURLE_OK)
{
std::wstringstream ss;
ss << curl_easy_strerror(res);
m_sError = L"Error occurred - " + std::wstring(ss.str());
return false;
}
else if (nHttpCode != 200)
{
SetErrorString(nHttpCode);
return false;
}
}
return true;
}
有人能告诉我,如果有一个错误在URL或在c++函数?
解决这个问题的方法是首先在rtsp字符串中提供用户凭据,然后连续两次发出rtsp DESCRIBE。如果用户凭证不正确或丢失,第一个RTSP DESCRIBE请求将导致HTTP 401错误码。第二个DESCRIBE请求将产生一个HTTP 200 OK代码。在第二个RTSP描述返回HTTP 200 OK之后,你可以发出一个RTSP SETUP请求,然后是一个RTSP PLAY请求,它应该返回HTTP 200并创建RTSP流。
相关文章:
- 来自 std::list 的迭代器 .end() 按预期返回"0xcdcdcdcdcdcdcdcd"但 .begin()
- 什么时候在C++中返回常量引用是个好主意
- 你能重载对象变量名本身返回的内容吗
- 为什么 Serial.println(<char[]>);返回随机字符?
- C++映射:具有自定义类的运算符[]不起作用(总是返回0)
- 如何获取std::result_of函数的返回类型
- QueryWorkingSet总是返回false
- (C++)分析树以计算返回错误值的简单算术表达式
- 访问者访问变体并返回不同类型时出错
- 如何返回一个类的两个对象相加的结果
- OpenInventor从9.8升级到10.4.2后,GLSL纹理返回零
- lower_bound()返回最后一个元素
- "throw expression code" 1e7 >返回 d 是什么?投掷标准::overflow_error( "too big" ) : d;意味 着?
- 奇怪的(对我来说)返回声明 - 在谷歌上找不到任何关于它的信息
- 如何取消对nullptr的屏蔽,返回正确的对象
- 奇怪的结构&GCC&clang(void*返回类型)
- 架构决策:返回std::future还是提供回调
- 从python中调用C++函数并获取返回值
- 矩阵向量乘法(cublasDgemv)返回零
- 使用libcurl v7.43.0的Axis相机上的RTSP description返回RTSP错误码400