修复zlm推流FMS,修正zlm的RTMP协议 (#1140)

* 修复zlm推流FMS,修正zlm的RTMP协议
Co-authored-by: 夏楚 <771730766@qq.com>
This commit is contained in:
haorui wang 2021-09-29 16:57:19 +08:00 committed by GitHub
parent 1292ec6d49
commit adc6f652bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -61,7 +61,8 @@ using namespace toolkit;
#define STREAM_CONTROL 0 #define STREAM_CONTROL 0
#define STREAM_MEDIA 1 #define STREAM_MEDIA 1
#define CHUNK_SERVER_REQUEST 2 /*服务器像客户端发出请求时的chunkID*/ #define CHUNK_NETWORK 2 /*网络相关的消息(参见 Protocol Control Messages)*/
#define CHUNK_SYSTEM 3 /*向服务器发送控制消息(反之亦可)*/
#define CHUNK_CLIENT_REQUEST_BEFORE 3 /*客户端在createStream前,向服务器发出请求的chunkID*/ #define CHUNK_CLIENT_REQUEST_BEFORE 3 /*客户端在createStream前,向服务器发出请求的chunkID*/
#define CHUNK_CLIENT_REQUEST_AFTER 4 /*客户端在createStream后,向服务器发出请求的chunkID*/ #define CHUNK_CLIENT_REQUEST_AFTER 4 /*客户端在createStream后,向服务器发出请求的chunkID*/
#define CHUNK_AUDIO 6 /*音频chunkID*/ #define CHUNK_AUDIO 6 /*音频chunkID*/

View File

@ -165,7 +165,13 @@ void RtmpProtocol::sendInvoke(const string &cmd, const AMFValue &val) {
} }
void RtmpProtocol::sendRequest(int cmd, const string& str) { void RtmpProtocol::sendRequest(int cmd, const string& str) {
sendRtmp(cmd, _stream_index, str, 0, CHUNK_SERVER_REQUEST); if (cmd <= MSG_SET_PEER_BW) {
// 若 cmd 属于 Protocol Control Messages ,则应使用 chunk id 2 发送
sendRtmp(cmd, _stream_index, str, 0, CHUNK_NETWORK);
} else {
// 否则使用 chunk id 发送(任意值3-128参见 obs 及 ffmpeg 选取 3)
sendRtmp(cmd, _stream_index, str, 0, CHUNK_SYSTEM);
}
} }
class BufferPartial : public Buffer { class BufferPartial : public Buffer {