mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
调整rtmp 的音视频chunkID以及其他细节
This commit is contained in:
parent
c3231d2156
commit
e3c1fb3648
@ -46,7 +46,8 @@ using namespace ZL::Util;
|
||||
#define CHUNK_SERVER_REQUEST 2 /*服务器像客户端发出请求时的chunkID*/
|
||||
#define CHUNK_CLIENT_REQUEST_BEFORE 3 /*客户端在createStream前,向服务器发出请求的chunkID*/
|
||||
#define CHUNK_CLIENT_REQUEST_AFTER 4 /*客户端在createStream后,向服务器发出请求的chunkID*/
|
||||
#define CHUNK_MEDIA 6 /*媒体chunkID*/
|
||||
#define CHUNK_AUDIO 6 /*音频chunkID*/
|
||||
#define CHUNK_VIDEO 7 /*视频chunkID*/
|
||||
|
||||
#define FLV_KEY_FRAME 1
|
||||
#define FLV_INTER_FRAME 2
|
||||
|
@ -126,13 +126,16 @@ inline void RtmpPlayer::send_connect() {
|
||||
AMFValue obj(AMF_OBJECT);
|
||||
obj.set("app", m_strApp);
|
||||
obj.set("tcUrl", m_strTcUrl);
|
||||
//未使用代理
|
||||
obj.set("fpad", false);
|
||||
//参考librtmp,什么作用?
|
||||
obj.set("capabilities", 15);
|
||||
//SUPPORT_VID_CLIENT_SEEK 支持seek
|
||||
obj.set("videoFunction", 1);
|
||||
//只支持aac
|
||||
obj.set("audioCodecs", 3191);
|
||||
obj.set("audioCodecs", (double)(0x0400));
|
||||
//只支持H264
|
||||
obj.set("videoCodecs", 252);
|
||||
obj.set("videoCodecs", (double)(0x0080));
|
||||
sendInvoke("connect", obj);
|
||||
addOnResultCB([this](AMFDecoder &dec){
|
||||
//TraceL << "connect result";
|
||||
|
@ -81,17 +81,13 @@ void RtmpSession::onCmd_connect(AMFDecoder &dec) {
|
||||
m_strApp = params["app"].as_string();
|
||||
bool ok = true; //(app == APP_NAME);
|
||||
AMFValue version(AMF_OBJECT);
|
||||
version.set("fmsVer", "ZLMediaKit");
|
||||
version.set("capabilities", 255.0);
|
||||
version.set("mode", 1.0);
|
||||
version.set("fmsVer", "FMS/3,0,1,123");
|
||||
version.set("capabilities", 31.0);
|
||||
AMFValue status(AMF_OBJECT);
|
||||
status.set("level", ok ? "status" : "error");
|
||||
status.set("code", ok ? "NetConnection.Connect.Success" : "NetConnection.Connect.InvalidApp");
|
||||
status.set("description", ok ? "Connection succeeded." : "InvalidApp.");
|
||||
status.set("objectEncoding", amfVer);
|
||||
AMFValue data(AMF_ECMA_ARRAY);
|
||||
data.set("version","0.0.0.1");
|
||||
status.set("data", data);
|
||||
sendReply(ok ? "_result" : "_error", version, status);
|
||||
if (!ok) {
|
||||
throw std::runtime_error("Unsupported application: " + m_strApp);
|
||||
|
@ -82,7 +82,7 @@ void RtspToRtmpMediaSource::makeVideoConfigPkt() {
|
||||
m_rtmpPkt.strBuf.append(m_pps);
|
||||
|
||||
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
|
||||
m_rtmpPkt.chunkId = CHUNK_MEDIA;
|
||||
m_rtmpPkt.chunkId = CHUNK_VIDEO;
|
||||
m_rtmpPkt.streamId = STREAM_MEDIA;
|
||||
m_rtmpPkt.timeStamp = 0;
|
||||
m_rtmpPkt.typeId = MSG_VIDEO;
|
||||
@ -116,7 +116,7 @@ void RtspToRtmpMediaSource::onGetH264(const H264Frame& frame) {
|
||||
m_rtmpPkt.strBuf.append(&frame.data[4], frame.data.size() - 4);
|
||||
|
||||
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
|
||||
m_rtmpPkt.chunkId = CHUNK_MEDIA;
|
||||
m_rtmpPkt.chunkId = CHUNK_VIDEO;
|
||||
m_rtmpPkt.streamId = STREAM_MEDIA;
|
||||
m_rtmpPkt.timeStamp = frame.timeStamp;
|
||||
m_rtmpPkt.typeId = MSG_VIDEO;
|
||||
@ -135,7 +135,7 @@ void RtspToRtmpMediaSource::onGetAdts(const AdtsFrame& frame) {
|
||||
m_rtmpPkt.strBuf.append((char *) frame.data + 7, frame.aac_frame_length - 7);
|
||||
|
||||
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
|
||||
m_rtmpPkt.chunkId = CHUNK_MEDIA;
|
||||
m_rtmpPkt.chunkId = CHUNK_AUDIO;
|
||||
m_rtmpPkt.streamId = STREAM_MEDIA;
|
||||
m_rtmpPkt.timeStamp = frame.timeStamp;
|
||||
m_rtmpPkt.typeId = MSG_AUDIO;
|
||||
@ -175,7 +175,7 @@ void RtspToRtmpMediaSource::makeAudioConfigPkt() {
|
||||
m_rtmpPkt.strBuf.append(m_pParser->getAudioCfg());
|
||||
|
||||
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
|
||||
m_rtmpPkt.chunkId = CHUNK_MEDIA;
|
||||
m_rtmpPkt.chunkId = CHUNK_AUDIO;
|
||||
m_rtmpPkt.streamId = STREAM_MEDIA;
|
||||
m_rtmpPkt.timeStamp = 0;
|
||||
m_rtmpPkt.typeId = MSG_AUDIO;
|
||||
|
Loading…
Reference in New Issue
Block a user