onNoneReader事件避免重复触发

This commit is contained in:
xiongziliang
2019-05-31 15:40:55 +08:00
parent ec190e3273
commit f5a80e3799
6 changed files with 36 additions and 12 deletions

View File

@@ -1089,7 +1089,8 @@ inline int RtspSession::getTrackIndexByInterleaved(int interleaved){
}
bool RtspSession::close(MediaSource &sender,bool force) {
if(!force && _pushSrc->readerCount() != 0){
//此回调在其他线程触发
if(!_pushSrc || (!force && _pushSrc->readerCount() != 0)){
return false;
}
string err = StrPrinter << "close media:" << sender.getSchema() << "/" << sender.getVhost() << "/" << sender.getApp() << "/" << sender.getId() << " " << force;
@@ -1098,6 +1099,15 @@ bool RtspSession::close(MediaSource &sender,bool force) {
}
void RtspSession::onNoneReader(MediaSource &sender){
//此回调在其他线程触发
if(!_pushSrc || _pushSrc->readerCount() != 0){
return;
}
MediaSourceEvent::onNoneReader(sender);
}
inline void RtspSession::sendRtpPacket(const RtpPacket::Ptr & pkt) {
//InfoP(this) <<(int)pkt.Interleaved;
switch (_rtpType) {