正在显示
2 个修改的文件
包含
19 行增加
和
2 行删除
@@ -164,8 +164,10 @@ int SrsEncoder::parse_scope_engines(SrsRequest* req) | @@ -164,8 +164,10 @@ int SrsEncoder::parse_scope_engines(SrsRequest* req) | ||
164 | std::string scope = ""; | 164 | std::string scope = ""; |
165 | if ((conf = _srs_config->get_transcode(req->vhost, scope)) != NULL) { | 165 | if ((conf = _srs_config->get_transcode(req->vhost, scope)) != NULL) { |
166 | if ((ret = parse_ffmpeg(req, conf)) != ERROR_SUCCESS) { | 166 | if ((ret = parse_ffmpeg(req, conf)) != ERROR_SUCCESS) { |
167 | + if (ret != ERROR_ENCODER_LOOP) { | ||
167 | srs_error("parse vhost scope=%s transcode engines failed. " | 168 | srs_error("parse vhost scope=%s transcode engines failed. " |
168 | "ret=%d", scope.c_str(), ret); | 169 | "ret=%d", scope.c_str(), ret); |
170 | + } | ||
169 | return ret; | 171 | return ret; |
170 | } | 172 | } |
171 | } | 173 | } |
@@ -173,8 +175,10 @@ int SrsEncoder::parse_scope_engines(SrsRequest* req) | @@ -173,8 +175,10 @@ int SrsEncoder::parse_scope_engines(SrsRequest* req) | ||
173 | scope = req->app; | 175 | scope = req->app; |
174 | if ((conf = _srs_config->get_transcode(req->vhost, scope)) != NULL) { | 176 | if ((conf = _srs_config->get_transcode(req->vhost, scope)) != NULL) { |
175 | if ((ret = parse_ffmpeg(req, conf)) != ERROR_SUCCESS) { | 177 | if ((ret = parse_ffmpeg(req, conf)) != ERROR_SUCCESS) { |
178 | + if (ret != ERROR_ENCODER_LOOP) { | ||
176 | srs_error("parse app scope=%s transcode engines failed. " | 179 | srs_error("parse app scope=%s transcode engines failed. " |
177 | "ret=%d", scope.c_str(), ret); | 180 | "ret=%d", scope.c_str(), ret); |
181 | + } | ||
178 | return ret; | 182 | return ret; |
179 | } | 183 | } |
180 | } | 184 | } |
@@ -183,8 +187,10 @@ int SrsEncoder::parse_scope_engines(SrsRequest* req) | @@ -183,8 +187,10 @@ int SrsEncoder::parse_scope_engines(SrsRequest* req) | ||
183 | scope += req->stream; | 187 | scope += req->stream; |
184 | if ((conf = _srs_config->get_transcode(req->vhost, scope)) != NULL) { | 188 | if ((conf = _srs_config->get_transcode(req->vhost, scope)) != NULL) { |
185 | if ((ret = parse_ffmpeg(req, conf)) != ERROR_SUCCESS) { | 189 | if ((ret = parse_ffmpeg(req, conf)) != ERROR_SUCCESS) { |
190 | + if (ret != ERROR_ENCODER_LOOP) { | ||
186 | srs_error("parse stream scope=%s transcode engines failed. " | 191 | srs_error("parse stream scope=%s transcode engines failed. " |
187 | "ret=%d", scope.c_str(), ret); | 192 | "ret=%d", scope.c_str(), ret); |
193 | + } | ||
188 | return ret; | 194 | return ret; |
189 | } | 195 | } |
190 | } | 196 | } |
@@ -234,7 +240,9 @@ int SrsEncoder::parse_ffmpeg(SrsRequest* req, SrsConfDirective* conf) | @@ -234,7 +240,9 @@ int SrsEncoder::parse_ffmpeg(SrsRequest* req, SrsConfDirective* conf) | ||
234 | SrsFFMPEG* ffmpeg = new SrsFFMPEG(ffmpeg_bin); | 240 | SrsFFMPEG* ffmpeg = new SrsFFMPEG(ffmpeg_bin); |
235 | if ((ret = initialize_ffmpeg(ffmpeg, req, engine)) != ERROR_SUCCESS) { | 241 | if ((ret = initialize_ffmpeg(ffmpeg, req, engine)) != ERROR_SUCCESS) { |
236 | srs_freep(ffmpeg); | 242 | srs_freep(ffmpeg); |
243 | + if (ret != ERROR_ENCODER_LOOP) { | ||
237 | srs_error("invalid transcode engine: %s %s", conf->arg0().c_str(), engine->arg0().c_str()); | 244 | srs_error("invalid transcode engine: %s %s", conf->arg0().c_str(), engine->arg0().c_str()); |
245 | + } | ||
238 | return ret; | 246 | return ret; |
239 | } | 247 | } |
240 | 248 | ||
@@ -260,6 +268,13 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | @@ -260,6 +268,13 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | ||
260 | input += "/"; | 268 | input += "/"; |
261 | input += req->stream; | 269 | input += req->stream; |
262 | 270 | ||
271 | + // stream name: vhost/app/stream for print | ||
272 | + input_stream_name = req->vhost; | ||
273 | + input_stream_name += "/"; | ||
274 | + input_stream_name += req->app; | ||
275 | + input_stream_name += "/"; | ||
276 | + input_stream_name += req->stream; | ||
277 | + | ||
263 | std::string output = _srs_config->get_engine_output(engine); | 278 | std::string output = _srs_config->get_engine_output(engine); |
264 | // output stream, to other/self server | 279 | // output stream, to other/self server |
265 | // ie. rtmp://127.0.0.1:1935/live/livestream_sd | 280 | // ie. rtmp://127.0.0.1:1935/live/livestream_sd |
@@ -287,7 +302,7 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | @@ -287,7 +302,7 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | ||
287 | it = std::find(_transcoded_url.begin(), _transcoded_url.end(), input); | 302 | it = std::find(_transcoded_url.begin(), _transcoded_url.end(), input); |
288 | if (it != _transcoded_url.end()) { | 303 | if (it != _transcoded_url.end()) { |
289 | ret = ERROR_ENCODER_LOOP; | 304 | ret = ERROR_ENCODER_LOOP; |
290 | - srs_info("detect a loop cycle, input=%s, output=%s, ignore it. ret=%d", | 305 | + srs_trace("detect a loop cycle, input=%s, output=%s, ignore it. ret=%d", |
291 | input.c_str(), output.c_str(), ret); | 306 | input.c_str(), output.c_str(), ret); |
292 | return ret; | 307 | return ret; |
293 | } | 308 | } |
@@ -305,7 +320,8 @@ void SrsEncoder::encoder() | @@ -305,7 +320,8 @@ void SrsEncoder::encoder() | ||
305 | // reportable | 320 | // reportable |
306 | if (pithy_print->can_print()) { | 321 | if (pithy_print->can_print()) { |
307 | // TODO: FIXME: show more info. | 322 | // TODO: FIXME: show more info. |
308 | - srs_trace("-> time=%"PRId64", encoders=%d", pithy_print->get_age(), (int)ffmpegs.size()); | 323 | + srs_trace("-> time=%"PRId64", encoders=%d, input=%s", |
324 | + pithy_print->get_age(), (int)ffmpegs.size(), input_stream_name.c_str()); | ||
309 | } | 325 | } |
310 | } | 326 | } |
311 | 327 |
@@ -48,6 +48,7 @@ class SrsFFMPEG; | @@ -48,6 +48,7 @@ class SrsFFMPEG; | ||
48 | class SrsEncoder : public ISrsThreadHandler | 48 | class SrsEncoder : public ISrsThreadHandler |
49 | { | 49 | { |
50 | private: | 50 | private: |
51 | + std::string input_stream_name; | ||
51 | std::vector<SrsFFMPEG*> ffmpegs; | 52 | std::vector<SrsFFMPEG*> ffmpegs; |
52 | private: | 53 | private: |
53 | SrsThread* pthread; | 54 | SrsThread* pthread; |
-
请 注册 或 登录 后发表评论