防止未开启录制功能时,使用该功能导致的bug

This commit is contained in:
xia-chu 2021-02-03 15:32:08 +08:00
parent 2b3ce0ec63
commit 827158af73

View File

@ -64,19 +64,21 @@ std::shared_ptr<MediaSinkInterface> Recorder::createRecorder(type type, const st
auto ret = std::make_shared<HlsRecorder>(path, enable_vhost ? string(VHOST_KEY) + "=" + vhost : ""); auto ret = std::make_shared<HlsRecorder>(path, enable_vhost ? string(VHOST_KEY) + "=" + vhost : "");
ret->setMediaSource(vhost, app, stream_id); ret->setMediaSource(vhost, app, stream_id);
return ret; return ret;
#else
throw std::invalid_argument("hls相关功能未打开请开启ENABLE_HLS宏后编译再测试");
#endif #endif
return nullptr;
} }
case Recorder::type_mp4: { case Recorder::type_mp4: {
#if defined(ENABLE_MP4) #if defined(ENABLE_MP4)
return std::make_shared<MP4Recorder>(path, vhost, app, stream_id); return std::make_shared<MP4Recorder>(path, vhost, app, stream_id);
#else
throw std::invalid_argument("mp4相关功能未打开请开启ENABLE_MP4宏后编译再测试");
#endif #endif
return nullptr;
} }
default: default: throw std::invalid_argument("未知的录制类型");
return nullptr;
} }
} }