From 6c97338712b7a35e575fc217510f47376373b281 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 7 Sep 2018 16:35:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/config.h | 2 +- src/Rtsp/RtspSession.cpp | 3 +-- tests/test_server.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Common/config.h b/src/Common/config.h index da21898e..3bbcca60 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -83,7 +83,7 @@ extern const char kBroadcastHttpRequest[]; //该流是否需要认证?是的话调用invoker并传入realm,否则传入空的realm.如果该事件不监听则不认证 extern const char kBroadcastOnGetRtspRealm[]; -#define BroadcastOnGetRtspRealmArgs const string &app,const string &stream,const RtspSession::onGetRealm &invoker,TcpSession &sender +#define BroadcastOnGetRtspRealmArgs const MediaInfo &args,const RtspSession::onGetRealm &invoker,TcpSession &sender //请求认证用户密码事件,user_name为用户名,must_no_encrypt如果为true,则必须提供明文密码(因为此时是base64认证方式),否则会导致认证失败 //获取到密码后请调用invoker并输入对应类型的密码和密码类型,invoker执行时会匹配密码 diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 19a0548b..2c783ae3 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -226,8 +226,7 @@ bool RtspSession::handleReq_Describe() { //广播是否需要认证事件 if(!NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastOnGetRtspRealm, - m_mediaInfo.m_app, - m_mediaInfo.m_streamid, + m_mediaInfo, invoker, *this)){ //无人监听此事件,说明无需认证 diff --git a/tests/test_server.cpp b/tests/test_server.cpp index 122f9677..0f85e6ee 100644 --- a/tests/test_server.cpp +++ b/tests/test_server.cpp @@ -64,7 +64,7 @@ using namespace ZL::Network; static onceToken s_token([](){ NoticeCenter::Instance().addListener(nullptr,Config::Broadcast::kBroadcastOnGetRtspRealm,[](BroadcastOnGetRtspRealmArgs){ - if(string("1") == stream ){ + if(string("1") == args.m_streamid ){ // live/1需要认证 EventPoller::Instance().async([invoker](){ //该流需要认证,并且设置realm