winlin

use system utilities

@@ -410,7 +410,7 @@ string SrsFlvSegment::generate_path() @@ -410,7 +410,7 @@ string SrsFlvSegment::generate_path()
410 std::string path_config = _srs_config->get_dvr_path(req->vhost); 410 std::string path_config = _srs_config->get_dvr_path(req->vhost);
411 411
412 // add [stream].[timestamp].flv as filename for dir 412 // add [stream].[timestamp].flv as filename for dir
413 - if (path_config.find(".flv") != path_config.length() - 4) { 413 + if (!srs_string_ends_with(path_config, ".flv")) {
414 path_config += "/[stream].[timestamp].flv"; 414 path_config += "/[stream].[timestamp].flv";
415 } 415 }
416 416
@@ -219,7 +219,7 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine) @@ -219,7 +219,7 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
219 // for not rtmp input, donot append the iformat, 219 // for not rtmp input, donot append the iformat,
220 // for example, "-f flv" before "-i udp://192.168.1.252:2222" 220 // for example, "-f flv" before "-i udp://192.168.1.252:2222"
221 // @see https://github.com/simple-rtmp-server/srs/issues/290 221 // @see https://github.com/simple-rtmp-server/srs/issues/290
222 - if (input.find("rtmp://") != 0) { 222 + if (!srs_string_starts_with(input, "rtmp://")) {
223 iformat = ""; 223 iformat = "";
224 } 224 }
225 225