@@ -3651,7 +3651,7 @@ srs_error_t SrsConfig::check_normal_config()
3651
3651
string n = conf->at (i)->name ;
3652
3652
if (n != " enabled" && n != " listen" && n != " dir" && n != " candidate" && n != " ecdsa"
3653
3653
&& n != " encrypt" && n != " reuseport" && n != " merge_nalus" && n != " perf_stat" && n != " black_hole"
3654
- && n != " ip_family" ) {
3654
+ && n != " ip_family" && n != " to_rtmp " ) {
3655
3655
return srs_error_new (ERROR_SYSTEM_CONFIG_INVALID, " illegal rtc_server.%s" , n.c_str ());
3656
3656
}
3657
3657
}
@@ -4946,6 +4946,248 @@ std::string SrsConfig::get_rtc_server_black_hole_addr()
4946
4946
return conf->arg0 ();
4947
4947
}
4948
4948
4949
+ int SrsConfig::get_rtc_server_rtmp_opus_payload_type ()
4950
+ {
4951
+ static int DEFAULT = 0 ;
4952
+
4953
+ SrsConfDirective* conf = root->get (" rtc_server" );
4954
+ if (!conf) {
4955
+ return DEFAULT;
4956
+ }
4957
+
4958
+ conf = conf->get (" to_rtmp" );
4959
+ if (!conf) {
4960
+ return DEFAULT;
4961
+ }
4962
+
4963
+ conf = conf->get (" opus_payload_type" );
4964
+ if (!conf) {
4965
+ return DEFAULT;
4966
+ }
4967
+
4968
+ return ::atoi (conf->arg0 ().c_str ());
4969
+ }
4970
+
4971
+ bool SrsConfig::get_rtc_server_rtmp_enabled ()
4972
+ {
4973
+ static bool DEFAULT = false ;
4974
+
4975
+ SrsConfDirective* conf = root->get (" rtc_server" );
4976
+ if (!conf) {
4977
+ return DEFAULT;
4978
+ }
4979
+
4980
+ conf = conf->get (" to_rtmp" );
4981
+ if (!conf) {
4982
+ return DEFAULT;
4983
+ }
4984
+
4985
+ conf = conf->get (" enabled" );
4986
+ if (!conf || conf->arg0 ().empty ()) {
4987
+ return DEFAULT;
4988
+ }
4989
+
4990
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
4991
+ }
4992
+
4993
+ std::string SrsConfig::get_rtc_server_rtmp_output ()
4994
+ {
4995
+ static std::string DEFAULT = " " ;
4996
+
4997
+ SrsConfDirective* conf = root->get (" rtc_server" );
4998
+ if (!conf) {
4999
+ return DEFAULT;
5000
+ }
5001
+
5002
+ conf = conf->get (" to_rtmp" );
5003
+ if (!conf) {
5004
+ return DEFAULT;
5005
+ }
5006
+
5007
+ conf = conf->get (" output" );
5008
+ if (!conf) {
5009
+ return DEFAULT;
5010
+ }
5011
+
5012
+ return conf->arg0 ().c_str ();
5013
+ }
5014
+
5015
+ bool SrsConfig::get_rtc_server_rtmp_source_copy ()
5016
+ {
5017
+ static bool DEFAULT = false ;
5018
+
5019
+ SrsConfDirective* conf = root->get (" rtc_server" );
5020
+ if (!conf) {
5021
+ return DEFAULT;
5022
+ }
5023
+
5024
+ conf = conf->get (" to_rtmp" );
5025
+ if (!conf) {
5026
+ return DEFAULT;
5027
+ }
5028
+
5029
+ conf = conf->get (" source_copy" );
5030
+ if (!conf || conf->arg0 ().empty ()) {
5031
+ return DEFAULT;
5032
+ }
5033
+
5034
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5035
+ }
5036
+
5037
+ std::string SrsConfig::get_rtc_server_rtmp_audio_format ()
5038
+ {
5039
+ static std::string DEFAULT = " rtp" ;
5040
+
5041
+ SrsConfDirective* conf = root->get (" rtc_server" );
5042
+ if (!conf) {
5043
+ return DEFAULT;
5044
+ }
5045
+
5046
+ conf = conf->get (" to_rtmp" );
5047
+ if (!conf) {
5048
+ return DEFAULT;
5049
+ }
5050
+
5051
+ conf = conf->get (" audio_format" );
5052
+ if (!conf || conf->arg0 ().empty ()) {
5053
+ return DEFAULT;
5054
+ }
5055
+
5056
+ return conf->arg0 ().c_str ();
5057
+ }
5058
+
5059
+ std::string SrsConfig::get_rtc_server_rtmp_record_path ()
5060
+ {
5061
+ static std::string DEFAULT = " record" ;
5062
+
5063
+ SrsConfDirective* conf = root->get (" rtc_server" );
5064
+ if (!conf) {
5065
+ return DEFAULT;
5066
+ }
5067
+
5068
+ conf = conf->get (" to_rtmp" );
5069
+ if (!conf) {
5070
+ return DEFAULT;
5071
+ }
5072
+
5073
+ conf = conf->get (" record_path" );
5074
+ if (!conf) {
5075
+ return DEFAULT;
5076
+ }
5077
+
5078
+ return conf->arg0 ().c_str ();
5079
+ }
5080
+
5081
+ int SrsConfig::get_rtc_server_rtmp_keyframe_interval_print ()
5082
+ {
5083
+ static int DEFAULT = 10 ;
5084
+
5085
+ SrsConfDirective* conf = root->get (" rtc_server" );
5086
+ if (!conf) {
5087
+ return DEFAULT;
5088
+ }
5089
+
5090
+ conf = conf->get (" to_rtmp" );
5091
+ if (!conf) {
5092
+ return DEFAULT;
5093
+ }
5094
+
5095
+ conf = conf->get (" keyframe_interval_print" );
5096
+ if (!conf) {
5097
+ return DEFAULT;
5098
+ }
5099
+
5100
+ return ::atoi (conf->arg0 ().c_str ());
5101
+ }
5102
+
5103
+ int SrsConfig::get_rtc_server_rtmp_req_keyframe ()
5104
+ {
5105
+ static int DEFAULT = 0 ;
5106
+
5107
+ SrsConfDirective* conf = root->get (" rtc_server" );
5108
+ if (!conf) {
5109
+ return DEFAULT;
5110
+ }
5111
+
5112
+ conf = conf->get (" to_rtmp" );
5113
+ if (!conf) {
5114
+ return DEFAULT;
5115
+ }
5116
+
5117
+ conf = conf->get (" req_keyframe" );
5118
+ if (!conf) {
5119
+ return DEFAULT;
5120
+ }
5121
+
5122
+ return ::atoi (conf->arg0 ().c_str ());
5123
+ }
5124
+
5125
+ bool SrsConfig::get_rtc_server_rtmp_record_video ()
5126
+ {
5127
+ static bool DEFAULT = false ;
5128
+
5129
+ SrsConfDirective* conf = root->get (" rtc_server" );
5130
+ if (!conf) {
5131
+ return DEFAULT;
5132
+ }
5133
+
5134
+ conf = conf->get (" to_rtmp" );
5135
+ if (!conf) {
5136
+ return DEFAULT;
5137
+ }
5138
+
5139
+ conf = conf->get (" record_video" );
5140
+ if (!conf || conf->arg0 ().empty ()) {
5141
+ return DEFAULT;
5142
+ }
5143
+
5144
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5145
+ }
5146
+
5147
+ bool SrsConfig::get_rtc_server_rtmp_record_audio ()
5148
+ {
5149
+ static bool DEFAULT = false ;
5150
+
5151
+ SrsConfDirective* conf = root->get (" rtc_server" );
5152
+ if (!conf) {
5153
+ return DEFAULT;
5154
+ }
5155
+
5156
+ conf = conf->get (" to_rtmp" );
5157
+ if (!conf) {
5158
+ return DEFAULT;
5159
+ }
5160
+
5161
+ conf = conf->get (" record_audio" );
5162
+ if (!conf || conf->arg0 ().empty ()) {
5163
+ return DEFAULT;
5164
+ }
5165
+
5166
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5167
+ }
5168
+
5169
+ bool SrsConfig::get_rtc_server_rtmp_audio_enabled ()
5170
+ {
5171
+ static bool DEFAULT = false ;
5172
+
5173
+ SrsConfDirective* conf = root->get (" rtc_server" );
5174
+ if (!conf) {
5175
+ return DEFAULT;
5176
+ }
5177
+
5178
+ conf = conf->get (" to_rtmp" );
5179
+ if (!conf) {
5180
+ return DEFAULT;
5181
+ }
5182
+
5183
+ conf = conf->get (" audio_enabled" );
5184
+ if (!conf || conf->arg0 ().empty ()) {
5185
+ return DEFAULT;
5186
+ }
5187
+
5188
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5189
+ }
5190
+
4949
5191
SrsConfDirective* SrsConfig::get_rtc (string vhost)
4950
5192
{
4951
5193
SrsConfDirective* conf = get_vhost (vhost);
0 commit comments