Skip to content

Commit

Permalink
Config: support rtmp_to_rtsp.
Browse files Browse the repository at this point in the history
  • Loading branch information
chundonglinlin committed Dec 3, 2023
1 parent 20fc40d commit 04573bd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions trunk/conf/rtsp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ rtsp_server {
}

vhost __defaultVhost__ {
rtmp_to_rtsp on;
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
Expand Down
21 changes: 20 additions & 1 deletion trunk/src/app/srs_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2577,7 +2577,7 @@ srs_error_t SrsConfig::check_normal_config()
&& n != "play" && n != "publish" && n != "cluster"
&& n != "security" && n != "http_remux" && n != "dash"
&& n != "http_static" && n != "hds" && n != "exec"
&& n != "in_ack_size" && n != "out_ack_size" && n != "rtc" && n != "srt") {
&& n != "in_ack_size" && n != "out_ack_size" && n != "rtc" && n != "srt" && n != "rtmp_to_rtsp") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal vhost.%s", n.c_str());
}
// for each sub directives of vhost.
Expand Down Expand Up @@ -8899,3 +8899,22 @@ int SrsConfig::get_rtsp_server_rtp_port_max()

return ::atoi(conf->arg0().c_str());
}

bool SrsConfig::get_rtsp_from_rtmp(string vhost)
{
SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.rtmp_to_rtsp"); // SRS_VHOST_RTMP_TO_RTC

static bool DEFAULT = false;

SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return DEFAULT;
}

conf = conf->get("rtmp_to_rtsp");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}

return SRS_CONF_PERFER_FALSE(conf->arg0());
}
1 change: 1 addition & 0 deletions trunk/src/app/srs_app_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ class SrsConfig
virtual std::string get_rtsp_server_listen();
virtual int get_rtsp_server_rtp_port_min();
virtual int get_rtsp_server_rtp_port_max();
virtual bool get_rtsp_from_rtmp(std::string vhost);
};

#endif
Expand Down

0 comments on commit 04573bd

Please sign in to comment.