mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
优化代码
This commit is contained in:
parent
b50a34bf1f
commit
68718953d4
@ -49,14 +49,9 @@ void MediaSink::addTrack(const Track::Ptr &track_in) {
|
||||
_ticker.resetTime();
|
||||
}
|
||||
|
||||
weak_ptr<MediaSink> weakSelf = shared_from_this();
|
||||
track->addDelegate(std::make_shared<FrameWriterInterfaceHelper>([weakSelf](const Frame::Ptr &frame){
|
||||
auto strongSelf = weakSelf.lock();
|
||||
if(!strongSelf){
|
||||
return;
|
||||
}
|
||||
if(!strongSelf->_anyTrackUnReady){
|
||||
strongSelf->onTrackFrame(frame);
|
||||
track->addDelegate(std::make_shared<FrameWriterInterfaceHelper>([this](const Frame::Ptr &frame){
|
||||
if(!_anyTrackUnReady){
|
||||
onTrackFrame(frame);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
* 该类的作用是等待Track ready()返回true也就是就绪后再通知派生类进行下一步的操作
|
||||
* 目的是输入Frame前由Track截取处理下,以便获取有效的信息(譬如sps pps aa_cfg)
|
||||
*/
|
||||
class MediaSink : public MediaSinkInterface , public TrackSource , public std::enable_shared_from_this<MediaSink>{
|
||||
class MediaSink : public MediaSinkInterface , public TrackSource{
|
||||
public:
|
||||
typedef std::shared_ptr<MediaSink> Ptr;
|
||||
MediaSink(){}
|
||||
|
Loading…
Reference in New Issue
Block a user