Commit df746060 by xiongziliang

Merge remote-tracking branch 'origin/master'

parents 1b663e43 d88fe077
media-server @ f1ee15ec
Subproject commit 49c146a4e35231ca94e7d0892d421e90a1a14bad Subproject commit f1ee15ec36a3bb311d3f1e5ec0816e0caf32639e
...@@ -277,6 +277,8 @@ void installWebHook(){ ...@@ -277,6 +277,8 @@ void installWebHook(){
body["ip"] = sender.get_peer_ip(); body["ip"] = sender.get_peer_ip();
body["port"] = sender.get_peer_port(); body["port"] = sender.get_peer_port();
body["id"] = sender.getIdentifier(); body["id"] = sender.getIdentifier();
body["originType"] = (int) type;
body["originTypeStr"] = getOriginTypeString(type);
//执行hook //执行hook
do_http_hook(hook_publish,body,[invoker](const Value &obj,const string &err){ do_http_hook(hook_publish,body,[invoker](const Value &obj,const string &err){
if(err.empty()){ if(err.empty()){
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <assert.h>
#include "Common/config.h" #include "Common/config.h"
#include "Util/util.h" #include "Util/util.h"
#include "Util/logger.h" #include "Util/logger.h"
......
...@@ -72,7 +72,7 @@ typedef std::function<void(const std::string &errMessage, bool enableHls, bool e ...@@ -72,7 +72,7 @@ typedef std::function<void(const std::string &errMessage, bool enableHls, bool e
//收到rtsp/rtmp推流事件广播,通过该事件控制推流鉴权 //收到rtsp/rtmp推流事件广播,通过该事件控制推流鉴权
extern const std::string kBroadcastMediaPublish; extern const std::string kBroadcastMediaPublish;
#define BroadcastMediaPublishArgs const MediaInfo &args,const Broadcast::PublishAuthInvoker &invoker,SockInfo &sender #define BroadcastMediaPublishArgs const MediaOriginType &type, const MediaInfo &args, const Broadcast::PublishAuthInvoker &invoker,SockInfo &sender
//播放鉴权结果回调对象 //播放鉴权结果回调对象
//如果errMessage为空则代表鉴权成功 //如果errMessage为空则代表鉴权成功
......
...@@ -212,7 +212,7 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) { ...@@ -212,7 +212,7 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
on_res(err, enableHls, enableMP4); on_res(err, enableHls, enableMP4);
}); });
}; };
auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, _media_info, invoker, static_cast<SockInfo &>(*this)); auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, MediaOriginType::rtmp_push, _media_info, invoker, static_cast<SockInfo &>(*this));
if(!flag){ if(!flag){
//该事件无人监听,默认鉴权成功 //该事件无人监听,默认鉴权成功
GET_CONFIG(bool,to_hls,General::kPublishToHls); GET_CONFIG(bool,to_hls,General::kPublishToHls);
......
...@@ -252,7 +252,7 @@ void RtpProcess::emitOnPublish() { ...@@ -252,7 +252,7 @@ void RtpProcess::emitOnPublish() {
}; };
//触发推流鉴权事件 //触发推流鉴权事件
auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, _media_info, invoker, static_cast<SockInfo &>(*this)); auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, MediaOriginType::rtp_push, _media_info, invoker, static_cast<SockInfo &>(*this));
if (!flag) { if (!flag) {
//该事件无人监听,默认不鉴权 //该事件无人监听,默认不鉴权
GET_CONFIG(bool, toHls, General::kPublishToHls); GET_CONFIG(bool, toHls, General::kPublishToHls);
......
...@@ -299,7 +299,7 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) { ...@@ -299,7 +299,7 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) {
}; };
//rtsp推流需要鉴权 //rtsp推流需要鉴权
auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, _media_info, invoker, static_cast<SockInfo &>(*this)); auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, MediaOriginType::rtsp_push, _media_info, invoker, static_cast<SockInfo &>(*this));
if (!flag) { if (!flag) {
//该事件无人监听,默认不鉴权 //该事件无人监听,默认不鉴权
GET_CONFIG(bool, toHls, General::kPublishToHls); GET_CONFIG(bool, toHls, General::kPublishToHls);
......
...@@ -1016,7 +1016,7 @@ void push_plugin(Session &sender, const string &offer_sdp, const WebRtcArgs &arg ...@@ -1016,7 +1016,7 @@ void push_plugin(Session &sender, const string &offer_sdp, const WebRtcArgs &arg
}; };
//rtsp推流需要鉴权 //rtsp推流需要鉴权
auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, info, invoker, static_cast<SockInfo &>(sender)); auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPublish, MediaOriginType::rtc_push, info, invoker, static_cast<SockInfo &>(sender));
if (!flag) { if (!flag) {
//该事件无人监听,默认不鉴权 //该事件无人监听,默认不鉴权
GET_CONFIG(bool, to_hls, General::kPublishToHls); GET_CONFIG(bool, to_hls, General::kPublishToHls);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论