merge upstream

This commit is contained in:
monktan
2020-10-25 17:48:37 +08:00
45 changed files with 743 additions and 404 deletions

View File

@@ -233,7 +233,7 @@ void FFmpegSource::setOnClose(const function<void()> &cb){
}
bool FFmpegSource::close(MediaSource &sender, bool force) {
auto listener = _listener.lock();
auto listener = getDelegate();
if(listener && !listener->close(sender,force)){
//关闭失败
return false;
@@ -258,17 +258,11 @@ std::shared_ptr<SockInfo> FFmpegSource::getOriginSock(MediaSource &sender) const
}
void FFmpegSource::onGetMediaSource(const MediaSource::Ptr &src) {
auto listener = src->getListener();
auto listener = src->getListener(true);
if (listener.lock().get() != this) {
//防止多次进入onGetMediaSource函数导致无递归调用的bug
_listener = listener;
//防止多次进入onGetMediaSource函数导致无递归调用的bug
setDelegate(listener);
src->setListener(shared_from_this());
} else {
WarnL << "多次触发onGetMediaSource事件:"
<< src->getSchema() << "/"
<< src->getVhost() << "/"
<< src->getApp() << "/"
<< src->getId();
}
}

View File

@@ -504,12 +504,12 @@ void installWebApi() {
allArgs["vhost"],
allArgs["app"],
allArgs["stream"]);
if(src){
if (src) {
bool flag = src->close(allArgs["force"].as<bool>());
val["result"] = flag ? 0 : -1;
val["msg"] = flag ? "success" : "close failed";
val["code"] = API::OtherFailed;
}else{
val["code"] = flag ? API::Success : API::OtherFailed;
} else {
val["result"] = -2;
val["msg"] = "can not find the stream";
val["code"] = API::OtherFailed;
@@ -1309,6 +1309,8 @@ void installWebApi() {
}
void unInstallWebApi(){
RtpSelector::Instance().clear();
{
lock_guard<recursive_mutex> lck(s_proxyMapMtx);
s_proxyMap.clear();
@@ -1318,6 +1320,7 @@ void unInstallWebApi(){
lock_guard<recursive_mutex> lck(s_ffmpegMapMtx);
s_ffmpegMap.clear();
}
{
#if defined(ENABLE_RTPPROXY)
lock_guard<recursive_mutex> lck(s_rtpServerMapMtx);