mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
修复rtsp播放器在处理rtp包时,清空状态导致的bug
This commit is contained in:
parent
2dd87c8b59
commit
c445ad2cdf
@ -116,9 +116,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void popIterator(typename map<SEQ, T>::iterator it) {
|
void popIterator(typename map<SEQ, T>::iterator it) {
|
||||||
_cb(it->first, it->second);
|
auto seq = it->first;
|
||||||
_next_seq_out = it->first + 1;
|
auto data = std::move(it->second);
|
||||||
_rtp_sort_cache_map.erase(it);
|
_rtp_sort_cache_map.erase(it);
|
||||||
|
_next_seq_out = seq + 1;
|
||||||
|
_cb(seq, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tryPopPacket() {
|
void tryPopPacket() {
|
||||||
|
@ -30,19 +30,23 @@ enum PlayType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
RtspPlayer::RtspPlayer(const EventPoller::Ptr &poller) : TcpClient(poller){
|
RtspPlayer::RtspPlayer(const EventPoller::Ptr &poller) : TcpClient(poller){
|
||||||
RtpReceiver::setPoolSize(64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RtspPlayer::~RtspPlayer(void) {
|
RtspPlayer::~RtspPlayer(void) {
|
||||||
DebugL << endl;
|
DebugL << endl;
|
||||||
}
|
}
|
||||||
void RtspPlayer::teardown(){
|
|
||||||
|
void RtspPlayer::sendTeardown(){
|
||||||
if (alive()) {
|
if (alive()) {
|
||||||
if (!_content_base.empty()) {
|
if (!_content_base.empty()) {
|
||||||
sendRtspRequest("TEARDOWN", _content_base);
|
sendRtspRequest("TEARDOWN", _content_base);
|
||||||
}
|
}
|
||||||
shutdown(SockException(Err_shutdown, "teardown"));
|
shutdown(SockException(Err_shutdown, "teardown"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RtspPlayer::teardown(){
|
||||||
|
sendTeardown();
|
||||||
_md5_nonce.clear();
|
_md5_nonce.clear();
|
||||||
_realm.clear();
|
_realm.clear();
|
||||||
_sdp_track.clear();
|
_sdp_track.clear();
|
||||||
@ -792,7 +796,7 @@ void RtspPlayer::onPlayResult_l(const SockException &ex , bool handshake_done) {
|
|||||||
//创建rtp数据接收超时检测定时器
|
//创建rtp数据接收超时检测定时器
|
||||||
_rtp_check_timer = std::make_shared<Timer>(timeoutMS / 2000.0, lam, getPoller());
|
_rtp_check_timer = std::make_shared<Timer>(timeoutMS / 2000.0, lam, getPoller());
|
||||||
} else {
|
} else {
|
||||||
teardown();
|
sendTeardown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ private:
|
|||||||
void sendSetup(unsigned int track_idx);
|
void sendSetup(unsigned int track_idx);
|
||||||
void sendPause(int type , uint32_t ms);
|
void sendPause(int type , uint32_t ms);
|
||||||
void sendDescribe();
|
void sendDescribe();
|
||||||
|
void sendTeardown();
|
||||||
void sendKeepAlive();
|
void sendKeepAlive();
|
||||||
void sendRtspRequest(const string &cmd, const string &url ,const StrCaseMap &header = StrCaseMap());
|
void sendRtspRequest(const string &cmd, const string &url ,const StrCaseMap &header = StrCaseMap());
|
||||||
void sendRtspRequest(const string &cmd, const string &url ,const std::initializer_list<string> &header);
|
void sendRtspRequest(const string &cmd, const string &url ,const std::initializer_list<string> &header);
|
||||||
|
Loading…
Reference in New Issue
Block a user