mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-30 23:02:24 +08:00
Fix SrtCaller Crash problem (#4171)
1.Fix the crash problem when SrtPlayer reveives an Ack packet 2.Remove SrtCaller's Check on streamid format to make it compatible with other SRT streaming service。 3.Modify the coding format: replace tab to space
This commit is contained in:
@@ -1,59 +1,59 @@
|
||||
/*
|
||||
* 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;
|
||||
};
|
||||
|
||||
using SrtPusherImp = PusherImp<SrtPusher, PusherBase>;
|
||||
|
||||
} /* namespace mediakit */
|
||||
#endif /* ZLMEDIAKIT_SRTPUSHER_H */
|
||||
/*
|
||||
* 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;
|
||||
};
|
||||
|
||||
using SrtPusherImp = PusherImp<SrtPusher, PusherBase>;
|
||||
|
||||
} /* namespace mediakit */
|
||||
#endif /* ZLMEDIAKIT_SRTPUSHER_H */
|
||||
|
||||
Reference in New Issue
Block a user