完善获取丢包率pull request; 新增MediaSource::getOwnerPoller接口

This commit is contained in:
xiongziliang
2022-06-11 12:56:03 +08:00
parent be995f9cd2
commit b6d3ec5251
5 changed files with 50 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
@@ -77,8 +77,10 @@ public:
virtual void onReaderChanged(MediaSource &sender, int size);
//流注册或注销事件
virtual void onRegist(MediaSource &sender, bool regist) {};
virtual int getLossRate(MediaSource &sender, TrackType type) {return -1;};
// 获取丢包率
virtual int getLossRate(MediaSource &sender, TrackType type) { return -1; }
// 获取所在线程
virtual toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) { return nullptr; }
////////////////////////仅供MultiMediaSourceMuxer对象继承////////////////////////
// 开启或关闭录制
@@ -145,6 +147,8 @@ public:
void startSendRtp(MediaSource &sender, const SendRtpArgs &args, const std::function<void(uint16_t, const toolkit::SockException &)> cb) override;
bool stopSendRtp(MediaSource &sender, const std::string &ssrc) override;
int getLossRate(MediaSource &sender, TrackType type) override;
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
private:
std::weak_ptr<MediaSourceEvent> _listener;
};
@@ -297,6 +301,10 @@ public:
void startSendRtp(const MediaSourceEvent::SendRtpArgs &args, const std::function<void(uint16_t, const toolkit::SockException &)> cb);
// 停止发送ps-rtp
bool stopSendRtp(const std::string &ssrc);
// 获取丢包率
int getLossRate(mediakit::TrackType type);
// 获取所在线程
toolkit::EventPoller::Ptr getOwnerPoller();
////////////////static方法查找或生成MediaSource////////////////