View the specific rtmp Protocol process from the crtmpserver

Source: Internet
Author: User

After receiving the 34bytes sent by the client, remove the 12bytes header and then use 22bytesDeserialize to decode [cpp] <span style = "font-size: 18px;"> switch (H_MT (header )) {... case when: {message [RM_INVOKE] [RM_INVOKE_IS_FLEX] = (bool) (H_MT (header) = RM_HEADER_MESSAGETYPE_FLEX); return DeserializeInvoke (buffer, message [RM_INVOKE]);} </span> [cpp] <span style = "font-size: 18px;"> bool RTMPProtocolSerializer: DeserializeInvoke (IOBuffer & Buffer, Variant & message) {if (message [RM_INVOKE_IS_FLEX]) {if (! Buffer. Ignore (1) {FATAL ("Unable to ignore 1 byte"); return false ;}} if (! _ Amf0.read1_string (buffer, message [RM_INVOKE_FUNCTION]) {FATAL ("Unable to read % s", STR (RM_INVOKE_FUNCTION); return false;} if (! _ Amf0.ReadDouble (buffer, message [RM_INVOKE_ID]) {FATAL ("Unable to read % s", STR (RM_INVOKE_ID); return false ;}for (uint32_t I = 0; GETAVAILABLEBYTESCOUNT (buffer)> 0; I ++) {if (! _ Amf0.Read (buffer, message [RM_INVOKE_PARAMS] [I]) {FATAL ("Unable to de-serialize invoke parameter % u", I); return false ;}} return true ;}</span> full data is consumed here in [cpp] <span style = "font-size: 18px;"> bool BaseRTMPAppProtocolHandler :: inboundMessageAvailable (BaseRTMPProtocol * pFrom, Variant & request) {switch (uint8_t) VH_MT (request) {case RM_HEADER_MESSAGETYPE_FLEX: {return ProcessInvoke (pFrom, re [Cpp] <span style = "font-size: 18px;"> bool BaseRTMPAppProtocolHandler: ProcessInvoke (BaseRTMPProtocol * pFrom, variant & request ){... else if (functionName = RM_INVOKE_FUNCTION_PLAY) {return ProcessInvokePlay (pFrom, request) ;}</span> here N more things [cpp] <span style = "font-size: 18px; "> bool BaseRTMPAppProtocolHandler: ProcessInvokePlay (BaseRTMPProtocol * pFrom, Variant & request) {... Generate the meta File here, generate the seek file} </span>, and then [cpp] www.2cto.com <span style = "font-size: 18px;"> void BaseOutNetRTMPStream:: SignalAttachedToInStream () {// 1. store the attached stream type to know how we shoshould proceed on detach... // 2. mirror the feeder chunk size... // 3. fix the time base... // 4. store the metadata... // 5. send abort messages on audio/video channels... // 6. stream is recorded. .. // 7. stream begin... if (_ sendOnStatusPlayMessages) {// 8. send NetStream. play. reset... // 9. netStream. play. start... // 10. Y | RtmpSampleAccess ...} // 11. Y onStatus code = "NetStream. data. start "... // 12. using Y onMetaData ...} </span> [cpp] <span style = "font-size: 18px;"> bool BaseInStream: Play (double absoluteTimestamp, double length) {if (! SignalPlay (absoluteTimestamp, length) {FATAL ("Unable to signal play"); return false;} define listnode <BaseOutStream *> * pTemp = _ pOutStreams; while (pTemp! = NULL) {if (! PTemp-> info-> SignalPlay (absoluteTimestamp, length) {WARN ("Unable to signal play on an outbound stream");} pTemp = pTemp-> pPrev ;} return true ;}</span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.