mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-15 04:25:58 +08:00
不支持的协议直接抛异常, 防止非法推拉流:#1725
This commit is contained in:
@@ -19,14 +19,14 @@ namespace mediakit {
|
||||
|
||||
PusherBase::Ptr PusherBase::createPusher(const EventPoller::Ptr &poller,
|
||||
const MediaSource::Ptr &src,
|
||||
const std::string & strUrl) {
|
||||
const std::string & url) {
|
||||
static auto releasePusher = [](PusherBase *ptr){
|
||||
onceToken token(nullptr,[&](){
|
||||
delete ptr;
|
||||
});
|
||||
ptr->teardown();
|
||||
};
|
||||
std::string prefix = FindField(strUrl.data(), NULL, "://");
|
||||
std::string prefix = FindField(url.data(), NULL, "://");
|
||||
|
||||
if (strcasecmp("rtsps",prefix.data()) == 0) {
|
||||
return PusherBase::Ptr(new TcpClientWithSSL<RtspPusherImp>(poller, std::dynamic_pointer_cast<RtspMediaSource>(src)), releasePusher);
|
||||
@@ -44,7 +44,7 @@ PusherBase::Ptr PusherBase::createPusher(const EventPoller::Ptr &poller,
|
||||
return PusherBase::Ptr(new RtmpPusherImp(poller, std::dynamic_pointer_cast<RtmpMediaSource>(src)), releasePusher);
|
||||
}
|
||||
|
||||
return PusherBase::Ptr(new RtspPusherImp(poller, std::dynamic_pointer_cast<RtspMediaSource>(src)), releasePusher);
|
||||
throw std::invalid_argument("not supported push schema:" + url);
|
||||
}
|
||||
|
||||
PusherBase::PusherBase() {
|
||||
|
||||
Reference in New Issue
Block a user