TSP/RTP協議直播推送庫EasyPusher推RTSP流至EasyDarwin開源平臺實現自定義Stre

基於EasyPusher sdk庫工程(即library module)實現一個推送客戶端很是簡單便捷,由於sdk端已經將各類煩人的狀態維護錯誤檢查權限斷定UI同步等功能都實現了,開發者僅僅只須要實現若干接口便可。函數

今天遇到一個客戶須要用EasyPusher推RTSP流至EasyDarwin流媒體服務,而後須要用Kurento服務拉EasyDarwin分發的RTSP流作其它應用,可是默認EasyPusher的流在EasyDarwin是有.sdp後綴的,可是Kurento服務不支持,須要咱們技術進行協助。spa

咱們先看下正常的效果,以下圖,紅色標註的爲視頻流的後綴名.sdp。3d

68.png

69.png

這個是由推流端決定的流名稱,須要修改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」視頻

70.png

看下效果以下圖:blog

相關文章
相關標籤/搜索