diff --git a/src/Rtsp/RtpReceiver.h b/src/Rtsp/RtpReceiver.h index f9a972f0..9832f649 100644 --- a/src/Rtsp/RtpReceiver.h +++ b/src/Rtsp/RtpReceiver.h @@ -116,9 +116,11 @@ private: } void popIterator(typename map::iterator it) { - _cb(it->first, it->second); - _next_seq_out = it->first + 1; + auto seq = it->first; + auto data = std::move(it->second); _rtp_sort_cache_map.erase(it); + _next_seq_out = seq + 1; + _cb(seq, data); } void tryPopPacket() { diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index e7f8e601..4f1dc306 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -30,19 +30,23 @@ enum PlayType { }; RtspPlayer::RtspPlayer(const EventPoller::Ptr &poller) : TcpClient(poller){ - RtpReceiver::setPoolSize(64); } + RtspPlayer::~RtspPlayer(void) { DebugL << endl; } -void RtspPlayer::teardown(){ + +void RtspPlayer::sendTeardown(){ if (alive()) { if (!_content_base.empty()) { sendRtspRequest("TEARDOWN", _content_base); } shutdown(SockException(Err_shutdown, "teardown")); } +} +void RtspPlayer::teardown(){ + sendTeardown(); _md5_nonce.clear(); _realm.clear(); _sdp_track.clear(); @@ -792,7 +796,7 @@ void RtspPlayer::onPlayResult_l(const SockException &ex , bool handshake_done) { //创建rtp数据接收超时检测定时器 _rtp_check_timer = std::make_shared(timeoutMS / 2000.0, lam, getPoller()); } else { - teardown(); + sendTeardown(); } } diff --git a/src/Rtsp/RtspPlayer.h b/src/Rtsp/RtspPlayer.h index 14a58766..fa459aa3 100644 --- a/src/Rtsp/RtspPlayer.h +++ b/src/Rtsp/RtspPlayer.h @@ -102,6 +102,7 @@ private: void sendSetup(unsigned int track_idx); void sendPause(int type , uint32_t ms); void sendDescribe(); + void sendTeardown(); void sendKeepAlive(); void sendRtspRequest(const string &cmd, const string &url ,const StrCaseMap &header = StrCaseMap()); void sendRtspRequest(const string &cmd, const string &url ,const std::initializer_list &header);