mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-06 03:28:09 +08:00
整理代码
This commit is contained in:
@@ -30,11 +30,13 @@ namespace mediakit {
|
||||
class RtmpSession: public TcpSession ,public RtmpProtocol , public MediaSourceEvent{
|
||||
public:
|
||||
typedef std::shared_ptr<RtmpSession> Ptr;
|
||||
RtmpSession(const Socket::Ptr &_sock);
|
||||
virtual ~RtmpSession();
|
||||
void onRecv(const Buffer::Ptr &pBuf) override;
|
||||
RtmpSession(const Socket::Ptr &sock);
|
||||
~RtmpSession() override;
|
||||
|
||||
void onRecv(const Buffer::Ptr &buf) override;
|
||||
void onError(const SockException &err) override;
|
||||
void onManager() override;
|
||||
|
||||
private:
|
||||
void onProcessCmd(AMFDecoder &dec);
|
||||
void onCmd_connect(AMFDecoder &dec);
|
||||
@@ -55,15 +57,15 @@ private:
|
||||
|
||||
void onSendMedia(const RtmpPacket::Ptr &pkt);
|
||||
void onSendRawData(const Buffer::Ptr &buffer) override{
|
||||
_ui64TotalBytes += buffer->size();
|
||||
_total_bytes += buffer->size();
|
||||
send(buffer);
|
||||
}
|
||||
void onRtmpChunk(RtmpPacket &chunkData) override;
|
||||
void onRtmpChunk(RtmpPacket &chunk_data) override;
|
||||
|
||||
template<typename first, typename second>
|
||||
inline void sendReply(const char *str, const first &reply, const second &status) {
|
||||
AMFEncoder invoke;
|
||||
invoke << str << _dNowReqID << reply << status;
|
||||
invoke << str << _recv_req_id << reply << status;
|
||||
sendResponse(MSG_CMD, invoke.data());
|
||||
}
|
||||
|
||||
@@ -74,29 +76,30 @@ private:
|
||||
void setSocketFlags();
|
||||
string getStreamId(const string &str);
|
||||
void dumpMetadata(const AMFValue &metadata);
|
||||
|
||||
private:
|
||||
std::string _strTcUrl;
|
||||
MediaInfo _mediaInfo;
|
||||
double _dNowReqID = 0;
|
||||
bool _paused = false;
|
||||
bool _set_meta_data = false;
|
||||
Ticker _ticker;//数据接收时间
|
||||
RtmpMediaSource::RingType::RingReader::Ptr _pRingReader;
|
||||
std::shared_ptr<RtmpMediaSourceImp> _pPublisherSrc;
|
||||
std::weak_ptr<RtmpMediaSource> _pPlayerSrc;
|
||||
double _recv_req_id = 0;
|
||||
//消耗的总流量
|
||||
uint64_t _total_bytes = 0;
|
||||
|
||||
std::string _tc_url;
|
||||
//时间戳修整器
|
||||
Stamp _stamp[2];
|
||||
//消耗的总流量
|
||||
uint64_t _ui64TotalBytes = 0;
|
||||
bool _paused = false;
|
||||
//数据接收超时计时器
|
||||
Ticker _ticker;
|
||||
MediaInfo _media_info;
|
||||
|
||||
std::weak_ptr<RtmpMediaSource> _player_src;
|
||||
std::shared_ptr<RtmpMediaSourceImp> _publisher_src;
|
||||
RtmpMediaSource::RingType::RingReader::Ptr _ring_reader;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 支持ssl加密的rtmp服务器
|
||||
*/
|
||||
typedef TcpSessionWithSSL<RtmpSession> RtmpSessionWithSSL;
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SRC_RTMP_RTMPSESSION_H_ */
|
||||
|
||||
Reference in New Issue
Block a user