mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-28 21:52:22 +08:00
move srt src like webrtc (#4471)
This commit is contained in:
62
srt/SrtPusher.h
Normal file
62
srt/SrtPusher.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
|
||||
*
|
||||
* Use of this source code is governed by MIT-like license that can be found in the
|
||||
* LICENSE file in the root of the source tree. All contributing project authors
|
||||
* may be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef ZLMEDIAKIT_SRTPUSHER_H
|
||||
#define ZLMEDIAKIT_SRTPUSHER_H
|
||||
|
||||
#include "Network/Socket.h"
|
||||
#include "Pusher/PusherBase.h"
|
||||
#include "Poller/Timer.h"
|
||||
#include "Util/TimeTicker.h"
|
||||
#include "srt/SrtTransport.hpp"
|
||||
#include "Http/HttpRequester.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "SrtCaller.h"
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
// 实现了srt代理推流功能
|
||||
class SrtPusher
|
||||
: public PusherBase , public SrtCaller {
|
||||
public:
|
||||
using Ptr = std::shared_ptr<SrtPusher>;
|
||||
|
||||
SrtPusher(const toolkit::EventPoller::Ptr &poller,const TSMediaSource::Ptr &src);
|
||||
~SrtPusher() override;
|
||||
|
||||
//// PusherBase override////
|
||||
void publish(const std::string &url) override;
|
||||
void teardown() override;
|
||||
|
||||
void doPublish();
|
||||
protected:
|
||||
|
||||
//// SrtCaller override////
|
||||
void onHandShakeFinished() override;
|
||||
void onResult(const toolkit::SockException &ex) override;
|
||||
|
||||
bool isPlayer() override {return false;}
|
||||
uint16_t getLatency() override;
|
||||
float getTimeOutSec() override;
|
||||
std::string getPassphrase() override;
|
||||
|
||||
protected:
|
||||
std::weak_ptr<TSMediaSource> _push_src;
|
||||
TSMediaSource::RingType::RingReader::Ptr _ts_reader;
|
||||
|
||||
size_t getSendSpeed() override;
|
||||
size_t getSendTotalBytes() override;
|
||||
};
|
||||
|
||||
using SrtPusherImp = PusherImp<SrtPusher, PusherBase>;
|
||||
|
||||
} /* namespace mediakit */
|
||||
#endif /* ZLMEDIAKIT_SRTPUSHER_H */
|
||||
Reference in New Issue
Block a user