@@ -446,13 +446,19 @@ RTMP_SetupStream(RTMP *r,
446446 AVal * subscribepath ,
447447 AVal * usherToken ,
448448 int dStart ,
449- int dStop , int bLiveStream , long int timeout )
449+ int dStop , int bLiveStream , long int timeout ,
450+ AVal * nlplaypath ,
451+ AVal * nltoken ,
452+ AVal * nlid )
450453{
454+ RTMP_LogPrintf ("Protocol : %s" , RTMPProtocolStrings [protocol & 7 ]);
451455 RTMP_Log (RTMP_LOGDEBUG , "Protocol : %s" , RTMPProtocolStrings [protocol & 7 ]);
452456 RTMP_Log (RTMP_LOGDEBUG , "Hostname : %.*s" , host -> av_len , host -> av_val );
453457 RTMP_Log (RTMP_LOGDEBUG , "Port : %d" , port );
454458 RTMP_Log (RTMP_LOGDEBUG , "Playpath : %s" , playpath -> av_val );
455459
460+ if (nlplaypath && nlplaypath -> av_val )
461+ RTMP_Log (RTMP_LOGDEBUG , "nlplaypath : %s" , nlplaypath -> av_val );
456462 if (tcUrl && tcUrl -> av_val )
457463 RTMP_Log (RTMP_LOGDEBUG , "tcUrl : %s" , tcUrl -> av_val );
458464 if (swfUrl && swfUrl -> av_val )
@@ -476,6 +482,8 @@ RTMP_SetupStream(RTMP *r,
476482
477483 RTMP_Log (RTMP_LOGDEBUG , "live : %s" , bLiveStream ? "yes" : "no" );
478484 RTMP_Log (RTMP_LOGDEBUG , "timeout : %ld sec" , timeout );
485+ RTMP_Log (RTMP_LOGDEBUG , "nltoken : %s" , nltoken -> av_val );
486+ RTMP_Log (RTMP_LOGDEBUG , "nlid : %s" , nlid -> av_val );
479487
480488#ifdef CRYPTO
481489 if (swfSHA256Hash != NULL && swfSize > 0 )
@@ -513,6 +521,12 @@ RTMP_SetupStream(RTMP *r,
513521 r -> Link .flashVer = RTMP_DefaultFlashVer ;
514522 if (subscribepath && subscribepath -> av_len )
515523 r -> Link .subscribepath = * subscribepath ;
524+ if (nlplaypath && nlplaypath -> av_len )
525+ r -> Link .nlplaypath = * nlplaypath ;
526+ if (nltoken && nltoken -> av_len )
527+ r -> Link .nltoken = * nltoken ;
528+ if (nlid && nlid -> av_len )
529+ r -> Link .nlid = * nlid ;
516530 if (usherToken && usherToken -> av_len )
517531 r -> Link .usherToken = * usherToken ;
518532 r -> Link .seekTime = dStart ;
@@ -1743,6 +1757,38 @@ RTMP_SendCreateStream(RTMP *r)
17431757 return RTMP_SendPacket (r , & packet , TRUE);
17441758}
17451759
1760+ SAVC (nlPlayNotice );
1761+
1762+ int
1763+ RTMP_SendNlplayNotice (RTMP * r , AVal * nlplaypath , AVal * nltoken , AVal * nlid )
1764+ {
1765+ RTMPPacket packet ;
1766+ char pbuf [256 ], * pend = pbuf + sizeof (pbuf );
1767+ char * enc ;
1768+
1769+ packet .m_nChannel = 0x03 ; /* control channel (invoke) */
1770+ packet .m_headerType = RTMP_PACKET_SIZE_MEDIUM ;
1771+ packet .m_packetType = RTMP_PACKET_TYPE_INVOKE ;
1772+ packet .m_nTimeStamp = 0 ;
1773+ packet .m_nInfoField2 = 0 ;
1774+ packet .m_hasAbsTimestamp = 0 ;
1775+ packet .m_body = pbuf + RTMP_MAX_HEADER_SIZE ;
1776+
1777+ enc = packet .m_body ;
1778+ enc = AMF_EncodeString (enc , pend , & av_nlPlayNotice );
1779+ enc = AMF_EncodeNumber (enc , pend , ++ r -> m_numInvokes );
1780+ * enc ++ = AMF_NULL ; /* NULL */
1781+
1782+ enc = AMF_EncodeString (enc , pend , nlplaypath );
1783+ enc = AMF_EncodeString (enc , pend , nltoken );
1784+ enc = AMF_EncodeString (enc , pend , nlid );
1785+ packet .m_nBodySize = enc - packet .m_body ;
1786+
1787+ r -> Link .playpath = * nlid ;
1788+
1789+ return RTMP_SendPacket (r , & packet , TRUE);
1790+ }
1791+
17461792SAVC (FCSubscribe );
17471793
17481794static int
@@ -1759,7 +1805,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribepath)
17591805 packet .m_hasAbsTimestamp = 0 ;
17601806 packet .m_body = pbuf + RTMP_MAX_HEADER_SIZE ;
17611807
1762- RTMP_Log (RTMP_LOGDEBUG , "FCSubscribe : %s" , subscribepath -> av_val );
1808+ RTMP_Log (RTMP_LOGDEBUG , "AAAAAAFCSubscribe : %s" , subscribepath -> av_val );
17631809 enc = packet .m_body ;
17641810 enc = AMF_EncodeString (enc , pend , & av_FCSubscribe );
17651811 enc = AMF_EncodeNumber (enc , pend , ++ r -> m_numInvokes );
@@ -2954,6 +3000,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
29543000
29553001 if (AVMATCH (& methodInvoked , & av_connect ))
29563002 {
3003+
29573004 if (r -> Link .token .av_len )
29583005 {
29593006 AMFObjectProperty p ;
@@ -2965,6 +3012,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
29653012 }
29663013 if (r -> Link .protocol & RTMP_FEATURE_WRITE )
29673014 {
3015+ RTMP_Log (RTMP_LOGDEBUG , "Link.protocol %d" , r -> Link .protocol );
29683016 SendReleaseStream (r );
29693017 SendFCPublish (r );
29703018 }
@@ -2984,7 +3032,12 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
29843032 if (r -> Link .subscribepath .av_len )
29853033 SendFCSubscribe (r , & r -> Link .subscribepath );
29863034 else if (r -> Link .lFlags & RTMP_LF_LIVE )
2987- SendFCSubscribe (r , & r -> Link .playpath );
3035+ {
3036+ if (r -> Link .nlplaypath .av_len != 0 )
3037+ RTMP_SendNlplayNotice (r , & r -> Link .nlplaypath , & r -> Link .nltoken , & r -> Link .nlid );
3038+ else
3039+ SendFCSubscribe (r , & r -> Link .playpath );
3040+ }
29883041 }
29893042 }
29903043 else if (AVMATCH (& methodInvoked , & av_createStream ))
0 commit comments