@@ -349,41 +349,74 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient
349349 memset (st_RTMPCommand.tszCMDName , ' \0 ' , sizeof (st_RTMPCommand.tszCMDName ));
350350 st_RTMPCommand.nProCount = 0 ;
351351 st_RTMPCommand.nObCount = 0 ;
352- // RTMP拉流端
353- XENGINE_RTMPUSERCONTROL st_RTMPControl;
354- memset (&st_RTMPControl, ' \0 ' , sizeof (XENGINE_RTMPUSERCONTROL));
355-
356- st_RTMPControl.nControlID = XENGINE_STREAMMEDIA_RTMP_CONTROL_STREAMBEGIN;
357- st_RTMPControl.nValue32 = 1 ;
358- // 流开始
359- RTMPProtocol_Help_PKTUserControl (ptszSDBuffer, &nSDLen, &st_RTMPControl);
360- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP);
361- // 状态,有没有这个流
362- st_RTMPCommand.nProCount = 3 ;
363- BaseLib_Memory_Malloc ((XPPPMEM)&st_RTMPCommand.ppSt_CMDProperty , st_RTMPCommand.nProCount , sizeof (XENGINE_RTMPCMDPROPERTY));
364-
365- strcpy (st_RTMPCommand.tszCMDName , XENGINE_STREAMMEDIA_RTMP_COMMAND_ONSTATUS);
366-
367- _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [0 ]->tszKeyBuffer , " level" );
368- st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
369- st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .nMLen = 6 ;
370- _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .tszMsgBuffer , " status" );
371-
372- _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [1 ]->tszKeyBuffer , " code" );
373- st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
374- st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .nMLen = 23 ;
375- _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .tszMsgBuffer , " NetStream.Publish.Start" );
376-
377- _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [2 ]->tszKeyBuffer , " description" );
378- st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
379- st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .nMLen = 10 ;
380- _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .tszMsgBuffer , " Start live" );
381- RTMPProtocol_Help_PKTCommand (ptszSDBuffer, &nSDLen, 5 , &st_RTMPCommand);
382- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP);
383352 // 发送RTMP包头
384- if (!ModuleSession_PushStream_FindStream (tszSMSAddr, tszPushAddr))
353+ if (ModuleSession_PushStream_FindStream (tszSMSAddr, tszPushAddr))
354+ {
355+ // RTMP拉流端
356+ XENGINE_RTMPUSERCONTROL st_RTMPControl;
357+ memset (&st_RTMPControl, ' \0 ' , sizeof (XENGINE_RTMPUSERCONTROL));
358+
359+ st_RTMPControl.nControlID = XENGINE_STREAMMEDIA_RTMP_CONTROL_STREAMBEGIN;
360+ st_RTMPControl.nValue32 = 1 ;
361+ // 流开始
362+ RTMPProtocol_Help_PKTUserControl (ptszSDBuffer, &nSDLen, &st_RTMPControl);
363+ XEngine_Network_Send (lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP);
364+ // 状态,有没有这个流
365+ st_RTMPCommand.nProCount = 3 ;
366+ BaseLib_Memory_Malloc ((XPPPMEM)&st_RTMPCommand.ppSt_CMDProperty , st_RTMPCommand.nProCount , sizeof (XENGINE_RTMPCMDPROPERTY));
367+
368+ strcpy (st_RTMPCommand.tszCMDName , XENGINE_STREAMMEDIA_RTMP_COMMAND_ONSTATUS);
369+
370+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [0 ]->tszKeyBuffer , " level" );
371+ st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
372+ st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .nMLen = 6 ;
373+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .tszMsgBuffer , " status" );
374+
375+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [1 ]->tszKeyBuffer , " code" );
376+ st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
377+ st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .nMLen = 23 ;
378+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .tszMsgBuffer , " NetStream.Publish.Start" );
379+
380+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [2 ]->tszKeyBuffer , " description" );
381+ st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
382+ st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .nMLen = 10 ;
383+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .tszMsgBuffer , " Start live" );
384+
385+ RTMPProtocol_Help_PKTCommand (ptszSDBuffer, &nSDLen, 5 , &st_RTMPCommand);
386+ XEngine_Network_Send (lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP);
387+ }
388+ else
385389 {
386- XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" 拉流端:%s,请求拉流的参数不正确:%s,错误:%lX" ), lpszClientAddr, tszSMSAddr, ModuleSession_GetLastError ());
390+ st_RTMPCommand.nProCount = 4 ;
391+ BaseLib_Memory_Malloc ((XPPPMEM)&st_RTMPCommand.ppSt_CMDProperty , st_RTMPCommand.nProCount , sizeof (XENGINE_RTMPCMDPROPERTY));
392+
393+ strcpy (st_RTMPCommand.tszCMDName , XENGINE_STREAMMEDIA_RTMP_COMMAND_ONSTATUS);
394+
395+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [0 ]->tszKeyBuffer , " level" );
396+ st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
397+ st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .nMLen = 5 ;
398+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [0 ]->st_CMDOBJect .tszMsgBuffer , " error" );
399+
400+ LPCXSTR lpszCMDString = _X (" NetStream.Play.StreamNotFound" );
401+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [1 ]->tszKeyBuffer , " code" );
402+ st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
403+ st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .nMLen = _tcsxlen (lpszCMDString);
404+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [1 ]->st_CMDOBJect .tszMsgBuffer , lpszCMDString);
405+
406+ LPCXSTR lpszCMDDescription = _X (" The stream does not exist" );
407+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [2 ]->tszKeyBuffer , " description" );
408+ st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
409+ st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .nMLen = _tcsxlen (lpszCMDDescription);
410+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [2 ]->st_CMDOBJect .tszMsgBuffer , lpszCMDDescription);
411+
412+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [3 ]->tszKeyBuffer , " details" );
413+ st_RTMPCommand.ppSt_CMDProperty [3 ]->st_CMDOBJect .byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING;
414+ st_RTMPCommand.ppSt_CMDProperty [3 ]->st_CMDOBJect .nMLen = _tcsxlen (tszSMSAddr);
415+ _tcsxcpy (st_RTMPCommand.ppSt_CMDProperty [3 ]->st_CMDOBJect .tszMsgBuffer , tszSMSAddr);
416+
417+ RTMPProtocol_Help_PKTCommand (ptszSDBuffer, &nSDLen, 3 , &st_RTMPCommand);
418+ XEngine_Network_Send (lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP);
419+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" 拉流端:%s,请求拉流的参数不正确:%s,流没有找到,错误:%lX" ), lpszClientAddr, tszSMSAddr, ModuleSession_GetLastError ());
387420 return false ;
388421 }
389422 // 配置头
0 commit comments