@@ -3651,7 +3651,8 @@ 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" && n != " rtp_cache" && n != " rtp_msg_cache" ) {
3654
+ && n != " ip_family" && n != " rtp_cache" && n != " rtp_msg_cache"
3655
+ && n != " to_rtmp" ) {
3655
3656
return srs_error_new (ERROR_SYSTEM_CONFIG_INVALID, " illegal rtc_server.%s" , n.c_str ());
3656
3657
}
3657
3658
}
@@ -5078,6 +5079,248 @@ std::string SrsConfig::get_rtc_server_black_hole_addr()
5078
5079
return conf->arg0 ();
5079
5080
}
5080
5081
5082
+ int SrsConfig::get_rtc_server_rtmp_opus_payload_type ()
5083
+ {
5084
+ static int DEFAULT = 0 ;
5085
+
5086
+ SrsConfDirective* conf = root->get (" rtc_server" );
5087
+ if (!conf) {
5088
+ return DEFAULT;
5089
+ }
5090
+
5091
+ conf = conf->get (" to_rtmp" );
5092
+ if (!conf) {
5093
+ return DEFAULT;
5094
+ }
5095
+
5096
+ conf = conf->get (" opus_payload_type" );
5097
+ if (!conf) {
5098
+ return DEFAULT;
5099
+ }
5100
+
5101
+ return ::atoi (conf->arg0 ().c_str ());
5102
+ }
5103
+
5104
+ bool SrsConfig::get_rtc_server_rtmp_enabled ()
5105
+ {
5106
+ static bool DEFAULT = false ;
5107
+
5108
+ SrsConfDirective* conf = root->get (" rtc_server" );
5109
+ if (!conf) {
5110
+ return DEFAULT;
5111
+ }
5112
+
5113
+ conf = conf->get (" to_rtmp" );
5114
+ if (!conf) {
5115
+ return DEFAULT;
5116
+ }
5117
+
5118
+ conf = conf->get (" enabled" );
5119
+ if (!conf || conf->arg0 ().empty ()) {
5120
+ return DEFAULT;
5121
+ }
5122
+
5123
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5124
+ }
5125
+
5126
+ std::string SrsConfig::get_rtc_server_rtmp_output ()
5127
+ {
5128
+ static std::string DEFAULT = " " ;
5129
+
5130
+ SrsConfDirective* conf = root->get (" rtc_server" );
5131
+ if (!conf) {
5132
+ return DEFAULT;
5133
+ }
5134
+
5135
+ conf = conf->get (" to_rtmp" );
5136
+ if (!conf) {
5137
+ return DEFAULT;
5138
+ }
5139
+
5140
+ conf = conf->get (" output" );
5141
+ if (!conf) {
5142
+ return DEFAULT;
5143
+ }
5144
+
5145
+ return conf->arg0 ().c_str ();
5146
+ }
5147
+
5148
+ bool SrsConfig::get_rtc_server_rtmp_source_copy ()
5149
+ {
5150
+ static bool DEFAULT = false ;
5151
+
5152
+ SrsConfDirective* conf = root->get (" rtc_server" );
5153
+ if (!conf) {
5154
+ return DEFAULT;
5155
+ }
5156
+
5157
+ conf = conf->get (" to_rtmp" );
5158
+ if (!conf) {
5159
+ return DEFAULT;
5160
+ }
5161
+
5162
+ conf = conf->get (" source_copy" );
5163
+ if (!conf || conf->arg0 ().empty ()) {
5164
+ return DEFAULT;
5165
+ }
5166
+
5167
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5168
+ }
5169
+
5170
+ std::string SrsConfig::get_rtc_server_rtmp_audio_format ()
5171
+ {
5172
+ static std::string DEFAULT = " rtp" ;
5173
+
5174
+ SrsConfDirective* conf = root->get (" rtc_server" );
5175
+ if (!conf) {
5176
+ return DEFAULT;
5177
+ }
5178
+
5179
+ conf = conf->get (" to_rtmp" );
5180
+ if (!conf) {
5181
+ return DEFAULT;
5182
+ }
5183
+
5184
+ conf = conf->get (" audio_format" );
5185
+ if (!conf || conf->arg0 ().empty ()) {
5186
+ return DEFAULT;
5187
+ }
5188
+
5189
+ return conf->arg0 ().c_str ();
5190
+ }
5191
+
5192
+ std::string SrsConfig::get_rtc_server_rtmp_record_path ()
5193
+ {
5194
+ static std::string DEFAULT = " record" ;
5195
+
5196
+ SrsConfDirective* conf = root->get (" rtc_server" );
5197
+ if (!conf) {
5198
+ return DEFAULT;
5199
+ }
5200
+
5201
+ conf = conf->get (" to_rtmp" );
5202
+ if (!conf) {
5203
+ return DEFAULT;
5204
+ }
5205
+
5206
+ conf = conf->get (" record_path" );
5207
+ if (!conf) {
5208
+ return DEFAULT;
5209
+ }
5210
+
5211
+ return conf->arg0 ().c_str ();
5212
+ }
5213
+
5214
+ int SrsConfig::get_rtc_server_rtmp_keyframe_interval_print ()
5215
+ {
5216
+ static int DEFAULT = 10 ;
5217
+
5218
+ SrsConfDirective* conf = root->get (" rtc_server" );
5219
+ if (!conf) {
5220
+ return DEFAULT;
5221
+ }
5222
+
5223
+ conf = conf->get (" to_rtmp" );
5224
+ if (!conf) {
5225
+ return DEFAULT;
5226
+ }
5227
+
5228
+ conf = conf->get (" keyframe_interval_print" );
5229
+ if (!conf) {
5230
+ return DEFAULT;
5231
+ }
5232
+
5233
+ return ::atoi (conf->arg0 ().c_str ());
5234
+ }
5235
+
5236
+ int SrsConfig::get_rtc_server_rtmp_req_keyframe ()
5237
+ {
5238
+ static int DEFAULT = 0 ;
5239
+
5240
+ SrsConfDirective* conf = root->get (" rtc_server" );
5241
+ if (!conf) {
5242
+ return DEFAULT;
5243
+ }
5244
+
5245
+ conf = conf->get (" to_rtmp" );
5246
+ if (!conf) {
5247
+ return DEFAULT;
5248
+ }
5249
+
5250
+ conf = conf->get (" req_keyframe" );
5251
+ if (!conf) {
5252
+ return DEFAULT;
5253
+ }
5254
+
5255
+ return ::atoi (conf->arg0 ().c_str ());
5256
+ }
5257
+
5258
+ bool SrsConfig::get_rtc_server_rtmp_record_video ()
5259
+ {
5260
+ static bool DEFAULT = false ;
5261
+
5262
+ SrsConfDirective* conf = root->get (" rtc_server" );
5263
+ if (!conf) {
5264
+ return DEFAULT;
5265
+ }
5266
+
5267
+ conf = conf->get (" to_rtmp" );
5268
+ if (!conf) {
5269
+ return DEFAULT;
5270
+ }
5271
+
5272
+ conf = conf->get (" record_video" );
5273
+ if (!conf || conf->arg0 ().empty ()) {
5274
+ return DEFAULT;
5275
+ }
5276
+
5277
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5278
+ }
5279
+
5280
+ bool SrsConfig::get_rtc_server_rtmp_record_audio ()
5281
+ {
5282
+ static bool DEFAULT = false ;
5283
+
5284
+ SrsConfDirective* conf = root->get (" rtc_server" );
5285
+ if (!conf) {
5286
+ return DEFAULT;
5287
+ }
5288
+
5289
+ conf = conf->get (" to_rtmp" );
5290
+ if (!conf) {
5291
+ return DEFAULT;
5292
+ }
5293
+
5294
+ conf = conf->get (" record_audio" );
5295
+ if (!conf || conf->arg0 ().empty ()) {
5296
+ return DEFAULT;
5297
+ }
5298
+
5299
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5300
+ }
5301
+
5302
+ bool SrsConfig::get_rtc_server_rtmp_audio_enabled ()
5303
+ {
5304
+ static bool DEFAULT = false ;
5305
+
5306
+ SrsConfDirective* conf = root->get (" rtc_server" );
5307
+ if (!conf) {
5308
+ return DEFAULT;
5309
+ }
5310
+
5311
+ conf = conf->get (" to_rtmp" );
5312
+ if (!conf) {
5313
+ return DEFAULT;
5314
+ }
5315
+
5316
+ conf = conf->get (" audio_enabled" );
5317
+ if (!conf || conf->arg0 ().empty ()) {
5318
+ return DEFAULT;
5319
+ }
5320
+
5321
+ return SRS_CONF_PERFER_FALSE (conf->arg0 ());
5322
+ }
5323
+
5081
5324
SrsConfDirective* SrsConfig::get_rtc (string vhost)
5082
5325
{
5083
5326
SrsConfDirective* conf = get_vhost (vhost);
0 commit comments