整理媒体事件相关代码,删除无须重载时的多余代码逻辑

This commit is contained in:
xiongzilaing 2022-08-28 17:25:56 +08:00 committed by ziyue
parent 67ad2a49c3
commit 679c79802f
23 changed files with 48 additions and 103 deletions

View File

@ -22,7 +22,6 @@ public:
template<typename ...ArgsType> template<typename ...ArgsType>
MediaHelper(ArgsType &&...args){ MediaHelper(ArgsType &&...args){
_channel = std::make_shared<DevChannel>(std::forward<ArgsType>(args)...); _channel = std::make_shared<DevChannel>(std::forward<ArgsType>(args)...);
_poller = EventPollerPool::Instance().getPoller();
} }
~MediaHelper(){} ~MediaHelper(){}
@ -59,11 +58,6 @@ public:
_on_regist_data = user_data; _on_regist_data = user_data;
} }
// 获取所属线程
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override {
return _poller;
}
protected: protected:
// 通知其停止推流 // 通知其停止推流
bool close(MediaSource &sender,bool force) override{ bool close(MediaSource &sender,bool force) override{
@ -105,11 +99,6 @@ protected:
return _on_speed(_on_speed_data, speed); return _on_speed(_on_speed_data, speed);
} }
// 观看总人数
int totalReaderCount(MediaSource &sender) override{
return _channel->totalReaderCount();
}
void onRegist(MediaSource &sender, bool regist) override{ void onRegist(MediaSource &sender, bool regist) override{
if (_on_regist) { if (_on_regist) {
_on_regist(_on_regist_data, &sender, regist); _on_regist(_on_regist_data, &sender, regist);
@ -117,7 +106,6 @@ protected:
} }
private: private:
EventPoller::Ptr _poller;
DevChannel::Ptr _channel; DevChannel::Ptr _channel;
on_mk_media_close _on_close = nullptr; on_mk_media_close _on_close = nullptr;
on_mk_media_seek _on_seek = nullptr; on_mk_media_seek _on_seek = nullptr;

View File

@ -592,7 +592,7 @@ MediaSource::Ptr MediaSource::createFromMP4(const string &schema, const string &
/////////////////////////////////////MediaSourceEvent////////////////////////////////////// /////////////////////////////////////MediaSourceEvent//////////////////////////////////////
void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){ void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){
if (size || totalReaderCount(sender)) { if (size || sender.totalReaderCount()) {
//还有人观看该视频,不触发关闭事件 //还有人观看该视频,不触发关闭事件
_async_close_timer = nullptr; _async_close_timer = nullptr;
return; return;
@ -736,7 +736,6 @@ toolkit::EventPoller::Ptr MediaSourceEventInterceptor::getOwnerPoller(MediaSourc
return EventPollerPool::Instance().getPoller(); return EventPollerPool::Instance().getPoller();
} }
bool MediaSourceEventInterceptor::setupRecord(MediaSource &sender, Recorder::type type, bool start, const string &custom_path, size_t max_second) { bool MediaSourceEventInterceptor::setupRecord(MediaSource &sender, Recorder::type type, bool start, const string &custom_path, size_t max_second) {
auto listener = _listener.lock(); auto listener = _listener.lock();
if (!listener) { if (!listener) {

View File

@ -54,6 +54,14 @@ class MediaSource;
class MediaSourceEvent { class MediaSourceEvent {
public: public:
friend class MediaSource; friend class MediaSource;
class NotImplemented : public std::runtime_error {
public:
template<typename ...T>
NotImplemented(T && ...args) : std::runtime_error(std::forward<T>(args)...) {}
~NotImplemented() override = default;
};
MediaSourceEvent(){}; MediaSourceEvent(){};
virtual ~MediaSourceEvent(){}; virtual ~MediaSourceEvent(){};
@ -72,16 +80,16 @@ public:
virtual bool speed(MediaSource &sender, float speed) { return false; } virtual bool speed(MediaSource &sender, float speed) { return false; }
// 通知其停止产生流 // 通知其停止产生流
virtual bool close(MediaSource &sender, bool force) { return false; } virtual bool close(MediaSource &sender, bool force) { return false; }
// 获取观看总人数 // 获取观看总人数,此函数一般强制重载
virtual int totalReaderCount(MediaSource &sender) = 0; virtual int totalReaderCount(MediaSource &sender) { throw NotImplemented(toolkit::demangle(typeid(*this).name()) + "::totalReaderCount not implemented"); }
// 通知观看人数变化 // 通知观看人数变化
virtual void onReaderChanged(MediaSource &sender, int size); virtual void onReaderChanged(MediaSource &sender, int size);
//流注册或注销事件 //流注册或注销事件
virtual void onRegist(MediaSource &sender, bool regist) {}; 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) = 0; virtual toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) { throw NotImplemented(toolkit::demangle(typeid(*this).name()) + "::getOwnerPoller not implemented"); }
////////////////////////仅供MultiMediaSourceMuxer对象继承//////////////////////// ////////////////////////仅供MultiMediaSourceMuxer对象继承////////////////////////
// 开启或关闭录制 // 开启或关闭录制

View File

@ -88,6 +88,7 @@ const std::string &MultiMediaSourceMuxer::getStreamId() const {
} }
MultiMediaSourceMuxer::MultiMediaSourceMuxer(const string &vhost, const string &app, const string &stream, float dur_sec, const ProtocolOption &option) { MultiMediaSourceMuxer::MultiMediaSourceMuxer(const string &vhost, const string &app, const string &stream, float dur_sec, const ProtocolOption &option) {
_poller = EventPollerPool::Instance().getPoller();
_vhost = vhost; _vhost = vhost;
_app = app; _app = app;
_stream_id = stream; _stream_id = stream;
@ -187,7 +188,12 @@ int MultiMediaSourceMuxer::totalReaderCount(MediaSource &sender) {
if (!listener) { if (!listener) {
return totalReaderCount(); return totalReaderCount();
} }
return listener->totalReaderCount(sender); try {
return listener->totalReaderCount(sender);
} catch (MediaSourceEvent::NotImplemented &) {
//listener未重载totalReaderCount
return totalReaderCount();
}
} }
//此函数可能跨线程调用 //此函数可能跨线程调用
@ -290,6 +296,19 @@ vector<Track::Ptr> MultiMediaSourceMuxer::getMediaTracks(MediaSource &sender, bo
return getTracks(trackReady); return getTracks(trackReady);
} }
EventPoller::Ptr MultiMediaSourceMuxer::getOwnerPoller(MediaSource &sender) {
auto listener = getDelegate();
if (!listener) {
return _poller;
}
try {
return listener->getOwnerPoller(sender);
} catch (MediaSourceEvent::NotImplemented &) {
// listener未重载getOwnerPoller
return _poller;
}
}
bool MultiMediaSourceMuxer::onTrackReady(const Track::Ptr &track) { bool MultiMediaSourceMuxer::onTrackReady(const Track::Ptr &track) {
if (CodecL16 == track->getCodecId()) { if (CodecL16 == track->getCodecId()) {
WarnL << "L16音频格式目前只支持RTSP协议推流拉流!!!"; WarnL << "L16音频格式目前只支持RTSP协议推流拉流!!!";

View File

@ -154,6 +154,11 @@ public:
*/ */
std::vector<Track::Ptr> getMediaTracks(MediaSource &sender, bool trackReady = true) const override; std::vector<Track::Ptr> getMediaTracks(MediaSource &sender, bool trackReady = true) const override;
/**
* 线
*/
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
const std::string& getVhost() const; const std::string& getVhost() const;
const std::string& getApp() const; const std::string& getApp() const;
const std::string& getStreamId() const; const std::string& getStreamId() const;
@ -201,6 +206,7 @@ private:
TSMediaSourceMuxer::Ptr _ts; TSMediaSourceMuxer::Ptr _ts;
MediaSinkInterface::Ptr _mp4; MediaSinkInterface::Ptr _mp4;
HlsRecorder::Ptr _hls; HlsRecorder::Ptr _hls;
toolkit::EventPoller::Ptr _poller;
//对象个数统计 //对象个数统计
toolkit::ObjectStatistic<MultiMediaSourceMuxer> _statistic; toolkit::ObjectStatistic<MultiMediaSourceMuxer> _statistic;

View File

@ -185,10 +185,6 @@ std::shared_ptr<SockInfo> PlayerProxy::getOriginSock(MediaSource &sender) const
return getSockInfo(); return getSockInfo();
} }
toolkit::EventPoller::Ptr PlayerProxy::getOwnerPoller(MediaSource &sender) {
return getPoller();
}
void PlayerProxy::onPlaySuccess() { void PlayerProxy::onPlaySuccess() {
GET_CONFIG(bool, reset_when_replay, General::kResetWhenRePlay); GET_CONFIG(bool, reset_when_replay, General::kResetWhenRePlay);
if (dynamic_pointer_cast<RtspMediaSource>(_media_src)) { if (dynamic_pointer_cast<RtspMediaSource>(_media_src)) {

View File

@ -59,7 +59,6 @@ private:
MediaOriginType getOriginType(MediaSource &sender) const override; MediaOriginType getOriginType(MediaSource &sender) const override;
std::string getOriginUrl(MediaSource &sender) const override; std::string getOriginUrl(MediaSource &sender) const override;
std::shared_ptr<toolkit::SockInfo> getOriginSock(MediaSource &sender) const override; std::shared_ptr<toolkit::SockInfo> getOriginSock(MediaSource &sender) const override;
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
void rePlay(const std::string &strUrl,int iFailedCnt); void rePlay(const std::string &strUrl,int iFailedCnt);
void onPlaySuccess(); void onPlaySuccess();

View File

@ -239,10 +239,6 @@ bool MP4Reader::close(MediaSource &sender, bool force) {
return true; return true;
} }
int MP4Reader::totalReaderCount(MediaSource &sender) {
return _muxer ? _muxer->totalReaderCount() : sender.readerCount();
}
MediaOriginType MP4Reader::getOriginType(MediaSource &sender) const { MediaOriginType MP4Reader::getOriginType(MediaSource &sender) const {
return MediaOriginType::mp4_vod; return MediaOriginType::mp4_vod;
} }

View File

@ -56,7 +56,6 @@ private:
bool speed(MediaSource &sender, float speed) override; bool speed(MediaSource &sender, float speed) override;
bool close(MediaSource &sender,bool force) override; bool close(MediaSource &sender,bool force) override;
int totalReaderCount(MediaSource &sender) override;
MediaOriginType getOriginType(MediaSource &sender) const override; MediaOriginType getOriginType(MediaSource &sender) const override;
std::string getOriginUrl(MediaSource &sender) const override; std::string getOriginUrl(MediaSource &sender) const override;
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override; toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;

View File

@ -599,10 +599,6 @@ std::shared_ptr<SockInfo> RtmpSession::getOriginSock(MediaSource &sender) const
return const_cast<RtmpSession *>(this)->shared_from_this(); return const_cast<RtmpSession *>(this)->shared_from_this();
} }
toolkit::EventPoller::Ptr RtmpSession::getOwnerPoller(MediaSource &sender) {
return getPoller();
}
void RtmpSession::setSocketFlags(){ void RtmpSession::setSocketFlags(){
GET_CONFIG(int, merge_write_ms, General::kMergeWriteMS); GET_CONFIG(int, merge_write_ms, General::kMergeWriteMS);
if (merge_write_ms > 0) { if (merge_write_ms > 0) {

View File

@ -80,7 +80,6 @@ private:
std::string getOriginUrl(MediaSource &sender) const override; std::string getOriginUrl(MediaSource &sender) const override;
// 获取媒体源客户端相关信息 // 获取媒体源客户端相关信息
std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override; std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override;
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
void setSocketFlags(); void setSocketFlags();
std::string getStreamId(const std::string &str); std::string getStreamId(const std::string &str);

View File

@ -229,14 +229,6 @@ string RtpProcess::getIdentifier() const {
return _media_info._streamid; return _media_info._streamid;
} }
int RtpProcess::getTotalReaderCount() {
return _muxer ? _muxer->totalReaderCount() : 0;
}
void RtpProcess::setListener(const std::weak_ptr<MediaSourceEvent> &listener) {
setDelegate(listener);
}
void RtpProcess::emitOnPublish() { void RtpProcess::emitOnPublish() {
weak_ptr<RtpProcess> weak_self = shared_from_this(); weak_ptr<RtpProcess> weak_self = shared_from_this();
Broadcast::PublishAuthInvoker invoker = [weak_self](const string &err, const ProtocolOption &option) { Broadcast::PublishAuthInvoker invoker = [weak_self](const string &err, const ProtocolOption &option) {

View File

@ -64,11 +64,8 @@ public:
uint16_t get_peer_port() override; uint16_t get_peer_port() override;
std::string getIdentifier() const override; std::string getIdentifier() const override;
int getTotalReaderCount();
void setListener(const std::weak_ptr<MediaSourceEvent> &listener);
void setHelper(const std::weak_ptr<RtcpContext> help); void setHelper(const std::weak_ptr<RtcpContext> help);
int getLossRate(MediaSource &sender, TrackType type) override;
protected: protected:
bool inputFrame(const Frame::Ptr &frame) override; bool inputFrame(const Frame::Ptr &frame) override;
bool addTrack(const Track::Ptr & track) override; bool addTrack(const Track::Ptr & track) override;
@ -80,6 +77,7 @@ protected:
std::string getOriginUrl(MediaSource &sender) const override; std::string getOriginUrl(MediaSource &sender) const override;
std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override; std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override;
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override; toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
int getLossRate(MediaSource &sender, TrackType type) override;
private: private:
void emitOnPublish(); void emitOnPublish();

View File

@ -131,12 +131,12 @@ RtpProcessHelper::~RtpProcessHelper() {
void RtpProcessHelper::attachEvent() { void RtpProcessHelper::attachEvent() {
//主要目的是close回调触发时能把对象从RtpSelector中删除 //主要目的是close回调触发时能把对象从RtpSelector中删除
_process->setListener(shared_from_this()); _process->setDelegate(shared_from_this());
} }
bool RtpProcessHelper::close(MediaSource &sender, bool force) { bool RtpProcessHelper::close(MediaSource &sender, bool force) {
//此回调在其他线程触发 //此回调在其他线程触发
if (!_process || (!force && _process->getTotalReaderCount())) { if (!_process || (!force && _process->totalReaderCount(sender))) {
return false; return false;
} }
auto parent = _parent.lock(); auto parent = _parent.lock();
@ -148,14 +148,6 @@ bool RtpProcessHelper::close(MediaSource &sender, bool force) {
return true; return true;
} }
int RtpProcessHelper::totalReaderCount(MediaSource &sender) {
return _process ? _process->getTotalReaderCount() : sender.totalReaderCount();
}
toolkit::EventPoller::Ptr RtpProcessHelper::getOwnerPoller(MediaSource &sender) {
return toolkit::EventPollerPool::Instance().getPoller();
}
RtpProcess::Ptr &RtpProcessHelper::getProcess() { RtpProcess::Ptr &RtpProcessHelper::getProcess() {
return _process; return _process;
} }

View File

@ -32,15 +32,11 @@ public:
protected: protected:
// 通知其停止推流 // 通知其停止推流
bool close(MediaSource &sender,bool force) override; bool close(MediaSource &sender,bool force) override;
// 观看总人数
int totalReaderCount(MediaSource &sender) override;
// 获取所属线程
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
private: private:
std::weak_ptr<RtpSelector > _parent;
RtpProcess::Ptr _process;
std::string _stream_id; std::string _stream_id;
RtpProcess::Ptr _process;
std::weak_ptr<RtpSelector > _parent;
}; };
class RtpSelector : public std::enable_shared_from_this<RtpSelector>{ class RtpSelector : public std::enable_shared_from_this<RtpSelector>{

View File

@ -101,7 +101,7 @@ void RtpSession::onRtpPacket(const char *data, size_t len) {
} }
//tcp情况下一个tcp链接只可能是一路流不需要通过多个ssrc来区分所以不需要频繁getProcess //tcp情况下一个tcp链接只可能是一路流不需要通过多个ssrc来区分所以不需要频繁getProcess
_process = RtpSelector::Instance().getProcess(_stream_id, true); _process = RtpSelector::Instance().getProcess(_stream_id, true);
_process->setListener(dynamic_pointer_cast<RtpSession>(shared_from_this())); _process->setDelegate(dynamic_pointer_cast<RtpSession>(shared_from_this()));
} }
try { try {
uint32_t rtp_ssrc = 0; uint32_t rtp_ssrc = 0;
@ -126,7 +126,7 @@ void RtpSession::onRtpPacket(const char *data, size_t len) {
bool RtpSession::close(MediaSource &sender, bool force) { bool RtpSession::close(MediaSource &sender, bool force) {
//此回调在其他线程触发 //此回调在其他线程触发
if(!_process || (!force && _process->getTotalReaderCount())){ if(!_process || (!force && static_pointer_cast<MediaSourceEvent>(_process)->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;
@ -134,15 +134,6 @@ bool RtpSession::close(MediaSource &sender, bool force) {
return true; return true;
} }
int RtpSession::totalReaderCount(MediaSource &sender) {
//此回调在其他线程触发
return _process ? _process->getTotalReaderCount() : sender.totalReaderCount();
}
toolkit::EventPoller::Ptr RtpSession::getOwnerPoller(MediaSource &sender) {
return getPoller();
}
static const char *findSSRC(const char *data, ssize_t len, uint32_t ssrc) { static const char *findSSRC(const char *data, ssize_t len, uint32_t ssrc) {
//rtp前面必须预留两个字节的长度字段 //rtp前面必须预留两个字节的长度字段
for (ssize_t i = 2; i <= len - 4; ++i) { for (ssize_t i = 2; i <= len - 4; ++i) {

View File

@ -36,13 +36,9 @@ public:
protected: protected:
// 通知其停止推流 // 通知其停止推流
bool close(MediaSource &sender,bool force) override; bool close(MediaSource &sender,bool force) override;
// 观看总人数
int totalReaderCount(MediaSource &sender) override;
// 获取所属线程
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
// 收到rtp回调 // 收到rtp回调
void onRtpPacket(const char *data, size_t len) override; void onRtpPacket(const char *data, size_t len) override;
// RtpSplitter override
const char *onSearchPacketTail(const char *data, size_t len) override; const char *onSearchPacketTail(const char *data, size_t len) override;
private: private:

View File

@ -1154,10 +1154,6 @@ std::shared_ptr<SockInfo> RtspSession::getOriginSock(MediaSource &sender) const
return const_cast<RtspSession *>(this)->shared_from_this(); return const_cast<RtspSession *>(this)->shared_from_this();
} }
toolkit::EventPoller::Ptr RtspSession::getOwnerPoller(MediaSource &sender) {
return getPoller();
}
void RtspSession::onBeforeRtpSorted(const RtpPacket::Ptr &rtp, int track_index){ void RtspSession::onBeforeRtpSorted(const RtpPacket::Ptr &rtp, int track_index){
updateRtcpContext(rtp); updateRtcpContext(rtp);
} }

View File

@ -91,7 +91,6 @@ protected:
std::string getOriginUrl(MediaSource &sender) const override; std::string getOriginUrl(MediaSource &sender) const override;
// 获取媒体源客户端相关信息 // 获取媒体源客户端相关信息
std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override; std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override;
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
/////TcpSession override//// /////TcpSession override////
ssize_t send(toolkit::Buffer::Ptr pkt) override; ssize_t send(toolkit::Buffer::Ptr pkt) override;

View File

@ -129,11 +129,6 @@ bool SrtTransportImp::close(mediakit::MediaSource &sender, bool force) {
return true; return true;
} }
// 播放总人数
int SrtTransportImp::totalReaderCount(mediakit::MediaSource &sender) {
return _muxer ? _muxer->totalReaderCount() : sender.readerCount();
}
// 获取媒体源类型 // 获取媒体源类型
mediakit::MediaOriginType SrtTransportImp::getOriginType(mediakit::MediaSource &sender) const { mediakit::MediaOriginType SrtTransportImp::getOriginType(mediakit::MediaSource &sender) const {
return MediaOriginType::srt_push; return MediaOriginType::srt_push;
@ -149,11 +144,6 @@ std::shared_ptr<SockInfo> SrtTransportImp::getOriginSock(mediakit::MediaSource &
return static_pointer_cast<SockInfo>(getSession()); return static_pointer_cast<SockInfo>(getSession());
} }
toolkit::EventPoller::Ptr SrtTransportImp::getOwnerPoller(MediaSource &sender){
auto session = getSession();
return session ? session->getPoller() : EventPollerPool::Instance().getPoller();
}
void SrtTransportImp::emitOnPublish() { void SrtTransportImp::emitOnPublish() {
std::weak_ptr<SrtTransportImp> weak_self = static_pointer_cast<SrtTransportImp>(shared_from_this()); std::weak_ptr<SrtTransportImp> weak_self = static_pointer_cast<SrtTransportImp>(shared_from_this());
Broadcast::PublishAuthInvoker invoker = [weak_self](const std::string &err, const ProtocolOption &option) { Broadcast::PublishAuthInvoker invoker = [weak_self](const std::string &err, const ProtocolOption &option) {

View File

@ -51,16 +51,12 @@ protected:
///////MediaSourceEvent override/////// ///////MediaSourceEvent override///////
// 关闭 // 关闭
bool close(mediakit::MediaSource &sender, bool force) override; bool close(mediakit::MediaSource &sender, bool force) override;
// 播放总人数
int totalReaderCount(mediakit::MediaSource &sender) override;
// 获取媒体源类型 // 获取媒体源类型
mediakit::MediaOriginType getOriginType(mediakit::MediaSource &sender) const override; mediakit::MediaOriginType getOriginType(mediakit::MediaSource &sender) const override;
// 获取媒体源url或者文件路径 // 获取媒体源url或者文件路径
std::string getOriginUrl(mediakit::MediaSource &sender) const override; std::string getOriginUrl(mediakit::MediaSource &sender) const override;
// 获取媒体源客户端相关信息 // 获取媒体源客户端相关信息
std::shared_ptr<SockInfo> getOriginSock(mediakit::MediaSource &sender) const override; std::shared_ptr<SockInfo> getOriginSock(mediakit::MediaSource &sender) const override;
// get poller
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
///////MediaSinkInterface override/////// ///////MediaSinkInterface override///////
void resetTracks() override {}; void resetTracks() override {};

View File

@ -150,8 +150,4 @@ void WebRtcPusher::onRtcConfigure(RtcConfigure &configure) const {
int WebRtcPusher::getLossRate(MediaSource &sender,mediakit::TrackType type){ int WebRtcPusher::getLossRate(MediaSource &sender,mediakit::TrackType type){
return WebRtcTransportImp::getLossRate(type); return WebRtcTransportImp::getLossRate(type);
}
toolkit::EventPoller::Ptr WebRtcPusher::getOwnerPoller(mediakit::MediaSource &sender) {
return getPoller();
} }

View File

@ -41,8 +41,6 @@ protected:
std::shared_ptr<SockInfo> getOriginSock(mediakit::MediaSource &sender) const override; std::shared_ptr<SockInfo> getOriginSock(mediakit::MediaSource &sender) const override;
// 获取丢包率 // 获取丢包率
int getLossRate(mediakit::MediaSource &sender,mediakit::TrackType type) override; int getLossRate(mediakit::MediaSource &sender,mediakit::TrackType type) override;
// 获取MediaSource归属线程
toolkit::EventPoller::Ptr getOwnerPoller(mediakit::MediaSource &sender) override;
private: private:
WebRtcPusher(const EventPoller::Ptr &poller, const mediakit::RtspMediaSourceImp::Ptr &src, WebRtcPusher(const EventPoller::Ptr &poller, const mediakit::RtspMediaSourceImp::Ptr &src,