关于sass:TSPRTP协议直播推送库EasyPusher推RTSP流至EasyDarwin开源平台实现自定义Stre

6次阅读

共计 1211 个字符,预计需要花费 4 分钟才能阅读完成。

基于 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”

看下成果如下图:

正文完
 0