mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
完善simulcast播放统计功能
This commit is contained in:
parent
7a02d2c8d6
commit
74a935a8cd
@ -792,8 +792,11 @@ void WebRtcTransportImp::onRtp_l(const char *buf, size_t len, bool rtx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//解析并排序rtp
|
//解析并排序rtp
|
||||||
assert(ref);
|
if (ref) {
|
||||||
ref->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len);
|
ref->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len);
|
||||||
|
} else {
|
||||||
|
WarnL << "rtp dropped, ssrc:" << ssrc << ", is rtx:" << rtx;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -945,7 +948,7 @@ void WebRtcTransportImp::onShutdown(const SockException &ex){
|
|||||||
|
|
||||||
bool WebRtcTransportImp::close(MediaSource &sender, bool force) {
|
bool WebRtcTransportImp::close(MediaSource &sender, bool force) {
|
||||||
//此回调在其他线程触发
|
//此回调在其他线程触发
|
||||||
if(!_push_src || (!force && _push_src->totalReaderCount())){
|
if (!force && totalReaderCount(sender)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string err = StrPrinter << "close media:" << sender.getSchema() << "/" << sender.getVhost() << "/" << sender.getApp() << "/" << sender.getId() << " " << force;
|
string err = StrPrinter << "close media:" << sender.getSchema() << "/" << sender.getVhost() << "/" << sender.getApp() << "/" << sender.getId() << " " << force;
|
||||||
@ -954,7 +957,11 @@ bool WebRtcTransportImp::close(MediaSource &sender, bool force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int WebRtcTransportImp::totalReaderCount(MediaSource &sender) {
|
int WebRtcTransportImp::totalReaderCount(MediaSource &sender) {
|
||||||
return _push_src ? _push_src->totalReaderCount() : sender.readerCount();
|
auto total_count = 0;
|
||||||
|
for (auto &src : _push_src_simulcast) {
|
||||||
|
total_count += src.second->totalReaderCount();
|
||||||
|
}
|
||||||
|
return total_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaOriginType WebRtcTransportImp::getOriginType(MediaSource &sender) const {
|
MediaOriginType WebRtcTransportImp::getOriginType(MediaSource &sender) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user