本文主要是介绍windows 调试rtmp协议遇到wireshark抓包出现unknown或send时遇到10054问题之解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、解决办法:
将chunksize 设置大一点,可以设置为10 * 1024 * 1024
二、通过协议设置
bool GetChunkSize(long nChunkStreamID, long nChunkDataSize, unsigned char* pOut, long& nOut)
{
#define CHUNK_BODY_SIZE 4
#define CHUNK_ARRAY_SIZE 16unsigned char btData[CHUNK_ARRAY_SIZE] = { 0 };//basic header// 0 0 0 0 0 0 1 0 #fmt为0, 可知message header 有11个字节btData[0] = nChunkStreamID;//时间戳btData[1] = 0;btData[2] = 0;btData[3] = 0;//Body占用字节数btData[6] = CHUNK_BODY_SIZE & 0xff;btData[5] = CHUNK_BODY_SIZE >> 8;btData[4] = CHUNK_BODY_SIZE >> 16;// Set Chunk Size// 通过MessageHeader.h 可知为1时是设置chunk size 大小btData[7] = 1;////message stream id//message stream id就是指该次媒体流的唯一标识,用于指明属于哪个流,用于区分不同流(NetConnection网络连接流或者是(某个)NetStream网络流)的消息。一个StreamId通常用以完成某些特定的工作. 如使用Id为0的Stream来完成客户端和服务器的连接和控制,用Id为1的Stream来完成Stream的控制和播放等工作.btData[8] = 0;btData[9] = 0;btData[10] = 0;btData[11] = 0;//body. chunk的大小btData[12] = (nChunkDataSize >> 24) & 0xff;btData[13] = (nChunkDataSize >> 16) & 0xff;btData[14] = (nChunkDataSize >> 8) & 0xff;btData[15] = nChunkDataSize & 0xff;//------------------------------------------------------------------------------------------memcpy(pOut, btData, CHUNK_ARRAY_SIZE);nOut = CHUNK_ARRAY_SIZE;
}
调用:
long nLenOfChunkPacket = 0;unsigned char btChunkPacket[1024] = { 0 };//RTMP Chunk Stream uses message type IDs 1, 2, 3, 5, and 6 for protocol control messages. These messages contain information needed by the RTMP Chunk Stream protocol. These protocol control messages MUST have message stream ID 0 (known as the control stream) and be sent in chunk stream ID 2.//RTMP uses message type ID 4 for User Control messages. These messages contain information used by the RTMP streaming layer. Protocol messages with IDs 1, 2, 3, 5, and 6 are used by the RTMP Chunk Stream protocol (Section 5.4). User Control messages SHOULD use message stream ID 0 (known as the control stream) and, when sent over RTMP Chunk Stream, be sent on chunk stream ID 2.GetChunkSize(2/*Chunk Stream ID with value 2 is reserved for low-level protocol control messages and commands*/, 10 * 1024 * 1024, btChunkPacket, nLenOfChunkPacket);send(socketID, btChunkPacket, nLenOfChunkPacket, 0);
这篇关于windows 调试rtmp协议遇到wireshark抓包出现unknown或send时遇到10054问题之解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!