winlin

fix #89, config to /dev/null to disable ffmpeg log. 0.9.117

@@ -228,6 +228,7 @@ Supported operating systems and hardware: @@ -228,6 +228,7 @@ Supported operating systems and hardware:
228 * 2013-10-17, Created.<br/> 228 * 2013-10-17, Created.<br/>
229 229
230 ## History 230 ## History
  231 +* v1.0, 2014-05-25, fix [#89](https://github.com/winlinvip/simple-rtmp-server/issues/89), config to /dev/null to disable ffmpeg log. 0.9.117
231 * v1.0, 2014-05-25, fix [#76](https://github.com/winlinvip/simple-rtmp-server/issues/76), allow edge vhost to add or remove. 0.9.114 232 * v1.0, 2014-05-25, fix [#76](https://github.com/winlinvip/simple-rtmp-server/issues/76), allow edge vhost to add or remove. 0.9.114
232 * v1.0, 2014-05-24, Johnny contribute [ossrs.net](http://ossrs.net). karthikeyan start to translate wiki to English. 233 * v1.0, 2014-05-24, Johnny contribute [ossrs.net](http://ossrs.net). karthikeyan start to translate wiki to English.
233 * v1.0, 2014-05-22, fix [#78](https://github.com/winlinvip/simple-rtmp-server/issues/78), st joinable thread must be stop by other threads, 0.9.113 234 * v1.0, 2014-05-22, fix [#78](https://github.com/winlinvip/simple-rtmp-server/issues/78), st joinable thread must be stop by other threads, 0.9.113
@@ -19,6 +19,7 @@ pid ./objs/srs.pid; @@ -19,6 +19,7 @@ pid ./objs/srs.pid;
19 chunk_size 60000; 19 chunk_size 60000;
20 # the logs dir. 20 # the logs dir.
21 # if enabled ffmpeg, each stracoding stream will create a log file. 21 # if enabled ffmpeg, each stracoding stream will create a log file.
  22 +# /dev/null to disable the log.
22 # default: ./objs 23 # default: ./objs
23 ff_log_dir ./objs; 24 ff_log_dir ./objs;
24 # the log tank, console or file. 25 # the log tank, console or file.
@@ -2410,6 +2410,12 @@ string SrsConfig::get_log_file() @@ -2410,6 +2410,12 @@ string SrsConfig::get_log_file()
2410 return conf->arg0(); 2410 return conf->arg0();
2411 } 2411 }
2412 2412
  2413 +bool SrsConfig::get_ffmpeg_log_enabled()
  2414 +{
  2415 + string log = get_ffmpeg_log_dir();
  2416 + return log != "/dev/null";
  2417 +}
  2418 +
2413 string SrsConfig::get_ffmpeg_log_dir() 2419 string SrsConfig::get_ffmpeg_log_dir()
2414 { 2420 {
2415 srs_assert(root); 2421 srs_assert(root);
@@ -253,6 +253,7 @@ public: @@ -253,6 +253,7 @@ public:
253 virtual bool get_log_tank_file(); 253 virtual bool get_log_tank_file();
254 virtual std::string get_log_level(); 254 virtual std::string get_log_level();
255 virtual std::string get_log_file(); 255 virtual std::string get_log_file();
  256 + virtual bool get_ffmpeg_log_enabled();
256 virtual std::string get_ffmpeg_log_dir(); 257 virtual std::string get_ffmpeg_log_dir();
257 // hls section 258 // hls section
258 private: 259 private:
@@ -287,18 +287,20 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir @@ -287,18 +287,20 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir
287 output = srs_string_replace(output, "[stream]", req->stream); 287 output = srs_string_replace(output, "[stream]", req->stream);
288 output = srs_string_replace(output, "[engine]", engine->arg0()); 288 output = srs_string_replace(output, "[engine]", engine->arg0());
289 289
290 - std::string log_file; 290 + std::string log_file = "/dev/null"; // disabled
291 // write ffmpeg info to log file. 291 // write ffmpeg info to log file.
292 - log_file = _srs_config->get_ffmpeg_log_dir();  
293 - log_file += "/";  
294 - log_file += "ffmpeg-encoder";  
295 - log_file += "-";  
296 - log_file += req->vhost;  
297 - log_file += "-";  
298 - log_file += req->app;  
299 - log_file += "-";  
300 - log_file += req->stream;  
301 - log_file += ".log"; 292 + if (_srs_config->get_ffmpeg_log_enabled()) {
  293 + log_file = _srs_config->get_ffmpeg_log_dir();
  294 + log_file += "/";
  295 + log_file += "ffmpeg-encoder";
  296 + log_file += "-";
  297 + log_file += req->vhost;
  298 + log_file += "-";
  299 + log_file += req->app;
  300 + log_file += "-";
  301 + log_file += req->stream;
  302 + log_file += ".log";
  303 + }
302 304
303 // important: loop check, donot transcode again. 305 // important: loop check, donot transcode again.
304 std::vector<std::string>::iterator it; 306 std::vector<std::string>::iterator it;
@@ -262,18 +262,20 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S @@ -262,18 +262,20 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
262 app = app.substr(0, pos); 262 app = app.substr(0, pos);
263 } 263 }
264 264
265 - std::string log_file; 265 + std::string log_file = "/dev/null"; // disabled
266 // write ffmpeg info to log file. 266 // write ffmpeg info to log file.
267 - log_file = _srs_config->get_ffmpeg_log_dir();  
268 - log_file += "/";  
269 - log_file += "ffmpeg-ingest";  
270 - log_file += "-";  
271 - log_file += vhost->arg0();  
272 - log_file += "-";  
273 - log_file += app;  
274 - log_file += "-";  
275 - log_file += stream;  
276 - log_file += ".log"; 267 + if (_srs_config->get_ffmpeg_log_enabled()) {
  268 + log_file = _srs_config->get_ffmpeg_log_dir();
  269 + log_file += "/";
  270 + log_file += "ffmpeg-ingest";
  271 + log_file += "-";
  272 + log_file += vhost->arg0();
  273 + log_file += "-";
  274 + log_file += app;
  275 + log_file += "-";
  276 + log_file += stream;
  277 + log_file += ".log";
  278 + }
277 279
278 // input 280 // input
279 std::string input_type = _srs_config->get_ingest_input_type(ingest); 281 std::string input_type = _srs_config->get_ingest_input_type(ingest);
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "116" 34 +#define VERSION_REVISION "117"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"