diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 105b062d..2489b290 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -150,8 +150,8 @@ void MediaInfo::parse(const string &url){ auto pos = steamid.find("?"); if(pos != string::npos){ _streamid = steamid.substr(0,pos); - _para_strs = steamid.substr(pos + 1); - _params = Parser::parseArgs(_para_strs); + _param_strs = steamid.substr(pos + 1); + _params = Parser::parseArgs(_param_strs); if(_params.find(VHOST_KEY) != _params.end()){ _vhost = _params[VHOST_KEY]; } diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index 3615f972..f705629f 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -85,7 +85,7 @@ public: string _app; string _streamid; StrCaseMap _params; - string _para_strs; + string _param_strs; }; diff --git a/src/Player/MediaPlayer.cpp b/src/Player/MediaPlayer.cpp index cc2df9db..3ec1dcd2 100644 --- a/src/Player/MediaPlayer.cpp +++ b/src/Player/MediaPlayer.cpp @@ -45,9 +45,6 @@ void MediaPlayer::play(const char* strUrl) { _strPrefix = strPrefix; _parser = PlayerBase::createPlayer(strUrl); _parser->setOnShutdown(_shutdownCB); - //todo(xzl) 修复此处 -// _parser->setOnVideoCB(_onGetVideoCB); -// _parser->setOnAudioCB(_onGetAudioCB); } _parser->setOnPlayResult(_playResultCB); _parser->mINI::operator=(*this); diff --git a/src/Rtmp/RtmpPlayerImp.h b/src/Rtmp/RtmpPlayerImp.h index 688b9515..d870f9ae 100644 --- a/src/Rtmp/RtmpPlayerImp.h +++ b/src/Rtmp/RtmpPlayerImp.h @@ -64,24 +64,14 @@ private: if(_pRtmpMediaSrc){ _pRtmpMediaSrc->onGetMetaData(val); } - try { - _parser.reset(new RtmpDemuxer(val)); - //todo(xzl) 修复此处 -// _parser->setOnVideoCB(_onGetVideoCB); -// _parser->setOnAudioCB(_onGetAudioCB); - return true; - } catch (std::exception &ex) { - WarnL << ex.what(); - return _pRtmpMediaSrc ? true : false; - } + _parser.reset(new RtmpDemuxer(val)); + return true; } void onMediaData(const RtmpPacket::Ptr &chunkData) override { - if(_parser){ - _parser->inputRtmp(chunkData); - } if(_pRtmpMediaSrc){ _pRtmpMediaSrc->onWrite(chunkData); - } + } + _parser->inputRtmp(chunkData); } private: diff --git a/src/Rtsp/RtspPlayerImp.h b/src/Rtsp/RtspPlayerImp.h index 8a95ef37..9ee2ec8b 100644 --- a/src/Rtsp/RtspPlayerImp.h +++ b/src/Rtsp/RtspPlayerImp.h @@ -67,26 +67,15 @@ private: if(_pRtspMediaSrc){ _pRtspMediaSrc->onGetSDP(sdp); } - try { - _parser.reset(new RtspDemuxer(sdp)); - //todo(xzl) 修复此处 -// _parser->setOnVideoCB(_onGetVideoCB); -// _parser->setOnAudioCB(_onGetAudioCB); - return true; - } catch (std::exception &ex) { - WarnL << ex.what(); - return _pRtspMediaSrc ? true : false; - } + _parser.reset(new RtspDemuxer(sdp)); + return true; } void onRecvRTP(const RtpPacket::Ptr &rtppt, const RtspTrack &track) override { - if(_parser){ - _parser->inputRtp(rtppt); - } - - if(_pRtspMediaSrc){ - _pRtspMediaSrc->onWrite(rtppt,true); - } - } + if(_pRtspMediaSrc){ + _pRtspMediaSrc->onWrite(rtppt,true); + } + _parser->inputRtp(rtppt); + } private: RtspMediaSource::Ptr _pRtspMediaSrc; diff --git a/tests/test_player.cpp b/tests/test_player.cpp index 25769ab0..76c218d9 100644 --- a/tests/test_player.cpp +++ b/tests/test_player.cpp @@ -68,6 +68,8 @@ int main(int argc, char *argv[]) { H264Decoder decoder; YuvDisplayer displayer; + //todo(xzl) 修复此处 +#if 0 player->setOnVideoCB([&](const H264Frame &frame) { #ifndef __MACH__ SDLDisplayerHelper::Instance().doTask([&, frame]() { @@ -93,7 +95,7 @@ int main(int argc, char *argv[]) { #endif }); - +#endif EventPoller::Instance().runLoop(); } UDPServer::Destory(); diff --git a/tests/test_server.cpp b/tests/test_server.cpp index 650821c1..f617ff74 100644 --- a/tests/test_server.cpp +++ b/tests/test_server.cpp @@ -34,7 +34,7 @@ #include "Http/HttpSession.h" #include "Shell/ShellSession.h" #include "Util/MD5.h" -#include "Rtmp/FlvMuxer.h" +#include "RtmpMuxer/FlvMuxer.h" #ifdef ENABLE_OPENSSL #include "Util/SSLBox.h" @@ -57,7 +57,7 @@ using namespace mediakit; static onceToken s_token([](){ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastOnGetRtspRealm,[](BroadcastOnGetRtspRealmArgs){ - if(string("1") == args.m_streamid ){ + if(string("1") == args._streamid ){ // live/1需要认证 EventPoller::Instance().async([invoker](){ //该流需要认证,并且设置realm @@ -104,7 +104,7 @@ static onceToken s_token([](){ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastRtmpPublish,[](BroadcastRtmpPublishArgs){ - InfoL << args.m_vhost << " " << args.m_app << " " << args.m_streamid << " " << args.m_param_strs ; + InfoL << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ; EventPoller::Instance().async([invoker](){ invoker("");//鉴权成功 //invoker("this is auth failed message");//鉴权失败 @@ -112,7 +112,7 @@ static onceToken s_token([](){ }); NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPlayed,[](BroadcastMediaPlayedArgs){ - InfoL << args.m_schema << " " << args.m_vhost << " " << args.m_app << " " << args.m_streamid << " " << args.m_param_strs ; + InfoL << args._schema << " " << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ; EventPoller::Instance().async([invoker](){ invoker("");//鉴权成功 //invoker("this is auth failed message");//鉴权失败