基于EasyPusher sdk库工程(即library module)实现一个推送客户端非常简单便捷,因为sdk端曾经将各种烦人的状态保护谬误查看权限断定UI同步等性能都实现了,开发者仅仅只须要实现若干接口即可。

明天遇到一个客户须要用EasyPusher推RTSP流至EasyDarwin流媒体服务,而后须要用Kurento服务拉EasyDarwin散发的RTSP流做其它利用,然而默认EasyPusher的流在EasyDarwin是有.sdp后缀的,然而Kurento服务不反对,须要咱们技术进行帮助。

咱们先看下失常的成果,如下图,红色标注的为视频流的后缀名.sdp。

这个是由推流端决定的流名称,须要批改EasyPusher代码模块,StartPush函数中定义参数sPushName为流名称,函数定义如下:

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”

看下成果如下图: