基于EasyPusher sdk库工程(即library module)实现一个推送客户端很是简单便捷,由于sdk端已经将各类烦人的状态维护错误检查权限断定UI同步等功能都实现了,开发者仅仅只须要实现若干接口便可。函数
今天遇到一个客户须要用EasyPusher推RTSP流至EasyDarwin流媒体服务,而后须要用Kurento服务拉EasyDarwin分发的RTSP流作其它应用,可是默认EasyPusher的流在EasyDarwin是有.sdp后缀的,可是Kurento服务不支持,须要咱们技术进行协助。spa
咱们先看下正常的效果,以下图,红色标注的为视频流的后缀名.sdp。3d
这个是由推流端决定的流名称,须要修改EasyPusher代码模块,StartPush函数中定义参数sPushName为流名称,函数定义以下:code
int CSourceManager::StartPush(char* ServerIp, int nPushPort, char* sPushName, int nPushBufSize, bool bPushRtmp)
m_sPushInfo.pusherHandle = EasyPusher_Create(); strcpy(m_sPushInfo.pushServerAddr, ServerIp); m_sPushInfo.pushServerPort = nPushPort; strcpy(m_sPushInfo.sdpName, sPushName); Easy_U32 nRet = 0; if (NULL != m_sPushInfo.pusherHandle ) { EasyPusher_SetEventCallback(m_sPushInfo.pusherHandle, __EasyPusher_Callback, 0, NULL); nRet = EasyPusher_StartStream(m_sPushInfo.pusherHandle , ServerIp, nPushPort, sPushName, EASY_RTP_OVER_TCP, "", "", (EASY_MEDIA_INFO_T*)&m_mediainfo, nPushBufSize, 0);//512-2048 } else { nRet = -1; } m_bPushRtmp = bPushRtmp; if (bPushRtmp) { if (!m_pEasyrtmp) { m_pEasyrtmp=new EasyRtmp(); } char szURL[MAX_PATH]; memset(szURL, 0, sizeof(MAX_PATH)); sprintf(szURL, "rtmp://%s:1935/live/%s", ServerIp, sPushName); nRet = m_pEasyrtmp->Link(szURL,1280); }
其中sPushName 为传入的Stream名称,咱们强制定义sPushName=”2”视频
看下效果以下图:blog