temp
This commit is contained in:
parent
9e706b187e
commit
4c66e3c37a
@ -62,7 +62,7 @@ private:
|
||||
static GstElement *create_pipeline(const Camera &cam, StreamType type);
|
||||
static std::string make_stream_key(const std::string &cam_name, StreamType type);
|
||||
static void update_status(const std::string &key, const StreamStatus &status);
|
||||
static void publish_stream_status(const Camera &cam, StreamType type, const std::string &seqNo, bool ok, const std::string &reason);
|
||||
static void publish_stream_status(const std::string &cam_name, StreamType type, const std::string &seqNo, bool ok, const std::string &reason);
|
||||
static inline std::string stream_type_suffix(StreamType type)
|
||||
{
|
||||
return (type == StreamType::MAIN) ? "_main" : "_sub";
|
||||
|
||||
@ -79,20 +79,22 @@ GstElement *RTMPManager::create_pipeline(const Camera &cam, StreamType type)
|
||||
|
||||
void RTMPManager::publish_stream_status(const std::string &cam_name, StreamType type, const std::string &seqNo, bool ok, const std::string &reason)
|
||||
{
|
||||
// 获取摄像头 index
|
||||
// 找 camera index
|
||||
int cam_index = -1;
|
||||
Camera *cam_ptr = nullptr;
|
||||
for (size_t i = 0; i < g_app_config.cameras.size(); ++i)
|
||||
{
|
||||
if (g_app_config.cameras[i].name == cam_name)
|
||||
{
|
||||
cam_index = static_cast<int>(i);
|
||||
cam_ptr = &g_app_config.cameras[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nlohmann::json ch_resp;
|
||||
ch_resp["loc"] = cam_index;
|
||||
ch_resp["url"] = ok ? get_stream_url(cam_name, type) : "";
|
||||
ch_resp["url"] = ok && cam_ptr ? get_stream_url(cam_ptr->name, type) : "";
|
||||
ch_resp["result"] = ok ? 0 : 1;
|
||||
ch_resp["reason"] = reason;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user