Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
李勇
/
McuClient
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
李勇
2017-02-23 10:43:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
14b20f500cff2c052c30e3ed4a3ab6f0d4806104
14b20f50
1 parent
aea4e05f
1.修改视频和音频模块代码,清理无效代码
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
14 行增加
和
93 行删除
src/apes/AudioApe.js
src/apes/VideoApe.js
src/apes/AudioApe.js
查看文件 @
14b20f5
...
...
@@ -63,8 +63,8 @@ class AudioApe extends Ape {
//同一个nodeId只允许推一个流,如果已经推了就不能再推
if
(
this
.
mediaModule
.
getOpeningMediaChannel
(
GlobalConfig
.
nodeId
)
!=
0
){
loger
.
warn
(
"publishVideo,已经存在一个流,不能再推"
);
return
;
loger
.
warn
(
"publishAudio,已经存在一个流,不能再推"
);
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
"已经存在一个流,不能再推"
};
}
//判断当前是否还有空闲的channle
...
...
@@ -146,12 +146,7 @@ class AudioApe extends Ape {
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
"不能再打开更多的设备"
};
}
}
/* message RCVideoSendDataRequestPdu {
required uint32 from_node_id = 1;//发起人
optional uint32 to_node_id = 2;//接收人,如果是0就是所有人都接收
optional uint32 actionType = 3;//消息指令类型;
optional bytes data = 4;//其他数据,这个根据actionType来确定数据的结构
}*/
let
audioSendPdu
=
new
pdu
[
'RCAudioSendDataRequestPdu'
];
audioSendPdu
.
type
=
pdu
.
RCPDU_AUDIO_SEND_DATA_REQUEST
;
...
...
@@ -177,14 +172,14 @@ class AudioApe extends Ape {
sendTableUpdateHandler
(
_channelInfo
)
{
loger
.
log
(
"audio,sendTableUpdateHandler "
);
let
updateModelPdu
=
this
.
packPdu
(
_channelInfo
,
_channelInfo
.
channelId
);
//let updateModelPdu=this.packPdu({},ApeConsts.VIDEO_OBJ_TABLE_ID+2);
let
updateModelPdu
=
this
.
packPdu
(
_channelInfo
,
_channelInfo
.
channelId
);
if
(
updateModelPdu
==
null
){
loger
.
warn
(
"sendTableUpdateHandler error,updateModelPdu=null"
);
return
;
}
let
tableItemPdu
=
new
pdu
[
'RCRegistryTableItemPdu'
];
tableItemPdu
.
itemIdx
=
_channelInfo
.
channelId
;
//tableItemPdu.itemIdx=ApeConsts.VIDEO_OBJ_TABLE_ID+2;
tableItemPdu
.
itemIdx
=
_channelInfo
.
channelId
;
tableItemPdu
.
owner
=
0
;
//收到flash的是这个值,不清楚先写固定
tableItemPdu
.
itemData
=
updateModelPdu
.
toArrayBuffer
();
...
...
@@ -235,39 +230,11 @@ class AudioApe extends Ape {
tableUpdateHandler
(
owner
,
itemIdx
,
itemData
)
{
// debugger;
let
videoChannelInfo
=
this
.
unPackPdu
(
owner
,
itemIdx
,
itemData
);
//videoChannelInfo.owner = owner;
//videoChannelInfo.channelId = itemIdx;
//videoChannelInfo.status = owner === 0 ? ApeConsts.CHANNEL_STATUS_RELEASED : videoChannelInfo.status;
//loger.log('视频消息处理 tableUpdateHandler.',videoChannelInfo);
this
.
mediaModule
.
mediaChannels
[
itemIdx
]
=
videoChannelInfo
;
this
.
_emit
(
MessageTypes
.
AUDIO_UPDATE
,
videoChannelInfo
);
/* switch (videoChannelInfo.status) {
case ApeConsts.CHANNEL_STATUS_RELEASED:
// 只能关闭自己的流
if (this.activeChannelId === videoChannelInfo.channelId) {
this.activeChannelId = 0;
this.activeURL = '';
this.emitVideoChange();
}
break;
case ApeConsts.CHANNEL_STATUS_OPENING:
//_playUrl = "rtmfp://" + Config.mediaServerAddr + ":" + Config.mediaServerPort + "/message/" + _streamName;
//_cdnUrl = "rtmp://" + Config.mediaCDNServerAddr + ":" + Config.mediaCDNServerPort + "/message/" + _streamName;
//this.activeChannelId = videoChannelInfo.channelId;
//// AMS/FMS
//if (this._classInfo.msType ==ApeConsts.MS_TYPE_FMS) {
// this.activeURL = `http://dazhi.3mang.com/live/${this._classInfo.classId}/${this._classInfo.classId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`;
//}else {
// this.activeURL = `http://hls.3mang.com/live/${this._classInfo.classId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`;
//}
// 任何人都可以打开流
this.emitVideoChange();
break;
default:
break;
}*/
let
updateChannelInfo
=
this
.
unPackPdu
(
owner
,
itemIdx
,
itemData
);
this
.
mediaModule
.
mediaChannels
[
itemIdx
]
=
updateChannelInfo
;
this
.
_emit
(
MessageTypes
.
AUDIO_UPDATE
,
updateChannelInfo
);
}
///////数据的封包和解包/////////////////////////////////////////
...
...
@@ -279,14 +246,6 @@ class AudioApe extends Ape {
return
null
;
}
/* message RCVideoChannelInfoPdu {
optional uint32 status = 1;//开启的状态
optional uint32 channel_id = 2;//唯一的频道id
optional uint32 timestamp = 3;//更新的时间戳
optional uint32 from_node_id = 4;//发起者的id
optional uint32 to_node_id = 5;//接收者的id,(如果是0,所有人都接收)
}*/
//判断type类型,根据type设置不同的参数
let
packPduModel
=
new
pdu
[
'RCAudioChannelInfoPdu'
];
packPduModel
.
status
=
_param
.
status
||
ApeConsts
.
CHANNEL_STATUS_RELEASED
;
...
...
@@ -309,9 +268,9 @@ class AudioApe extends Ape {
return
null
;
}
try
{
let
videoChannelInfo
=
pdu
[
'RCAudioChannelInfoPdu'
].
decode
(
itemData
);
loger
.
log
(
"unPackPdu"
,
videoChannelInfo
);
return
videoChannelInfo
;
let
packChannelInfo
=
pdu
[
'RCAudioChannelInfoPdu'
].
decode
(
itemData
);
loger
.
log
(
"unPackPdu"
,
packChannelInfo
);
return
packChannelInfo
;
}
catch
(
err
)
{
loger
.
log
(
"unPackPdu error,itemIdx="
+
itemIdx
+
" err:"
+
err
.
message
);
}
...
...
src/apes/VideoApe.js
查看文件 @
14b20f5
...
...
@@ -67,7 +67,7 @@ class VideoApe extends Ape {
//同一个nodeId只允许推一个流,如果已经推了就不能再推
if
(
this
.
mediaModule
.
getOpeningMediaChannel
(
GlobalConfig
.
nodeId
)
!=
0
){
loger
.
warn
(
"publishVideo,已经存在一个流,不能再推"
);
return
;
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
"已经存在一个流,不能再推"
}
;
}
//判断当前是否还有空闲的channle
...
...
@@ -250,38 +250,8 @@ class VideoApe extends Ape {
tableUpdateHandler
(
owner
,
itemIdx
,
itemData
)
{
// debugger;
let
videoChannelInfo
=
this
.
unPackPdu
(
owner
,
itemIdx
,
itemData
);
//videoChannelInfo.owner = owner;
//videoChannelInfo.channelId = itemIdx;
//videoChannelInfo.status = owner === 0 ? ApeConsts.CHANNEL_STATUS_RELEASED : videoChannelInfo.status;
//loger.log('视频消息处理 tableUpdateHandler.',videoChannelInfo);
this
.
mediaModule
.
mediaChannels
[
itemIdx
]
=
videoChannelInfo
;
this
.
_emit
(
MessageTypes
.
VIDEO_UPDATE
,
videoChannelInfo
);
/* switch (videoChannelInfo.status) {
case ApeConsts.CHANNEL_STATUS_RELEASED:
// 只能关闭自己的流
if (this.activeChannelId === videoChannelInfo.channelId) {
this.activeChannelId = 0;
this.activeURL = '';
this.emitVideoChange();
}
break;
case ApeConsts.CHANNEL_STATUS_OPENING:
//_playUrl = "rtmfp://" + Config.mediaServerAddr + ":" + Config.mediaServerPort + "/message/" + _streamName;
//_cdnUrl = "rtmp://" + Config.mediaCDNServerAddr + ":" + Config.mediaCDNServerPort + "/message/" + _streamName;
//this.activeChannelId = videoChannelInfo.channelId;
//// AMS/FMS
//if (this._classInfo.msType ==ApeConsts.MS_TYPE_FMS) {
// this.activeURL = `http://dazhi.3mang.com/live/${this._classInfo.classId}/${this._classInfo.classId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`;
//}else {
// this.activeURL = `http://hls.3mang.com/live/${this._classInfo.classId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`;
//}
// 任何人都可以打开流
this.emitVideoChange();
break;
default:
break;
}*/
}
///////数据的封包和解包/////////////////////////////////////////
...
...
@@ -293,14 +263,6 @@ class VideoApe extends Ape {
return
null
;
}
/* message RCVideoChannelInfoPdu {
optional uint32 status = 1;//开启的状态
optional uint32 channel_id = 2;//唯一的频道id
optional uint32 timestamp = 3;//更新的时间戳
optional uint32 from_node_id = 4;//发起者的id
optional uint32 to_node_id = 5;//接收者的id,(如果是0,所有人都接收)
}*/
//判断type类型,根据type设置不同的参数
let
packPduModel
=
new
pdu
[
'RCVideoChannelInfoPdu'
];
packPduModel
.
status
=
_param
.
status
||
ApeConsts
.
CHANNEL_STATUS_RELEASED
;
...
...
请
注册
或
登录
后发表评论