winlin

refine dvr, donot append the flv header.

@@ -383,7 +383,7 @@ int SrsDvrPlan::flv_open(string stream, string path) @@ -383,7 +383,7 @@ int SrsDvrPlan::flv_open(string stream, string path)
383 srs_error("append file stream for file %s failed. ret=%d", path.c_str(), ret); 383 srs_error("append file stream for file %s failed. ret=%d", path.c_str(), ret);
384 return ret; 384 return ret;
385 } 385 }
386 - srs_warn("dvr: always append to when exists, file=%s.", path.c_str()); 386 + srs_trace("dvr: always append to when exists, file=%s.", path.c_str());
387 } else { 387 } else {
388 if ((ret = fs->open(tmp_flv_file)) != ERROR_SUCCESS) { 388 if ((ret = fs->open(tmp_flv_file)) != ERROR_SUCCESS) {
389 srs_error("open file stream for file %s failed. ret=%d", path.c_str(), ret); 389 srs_error("open file stream for file %s failed. ret=%d", path.c_str(), ret);
@@ -396,8 +396,11 @@ int SrsDvrPlan::flv_open(string stream, string path) @@ -396,8 +396,11 @@ int SrsDvrPlan::flv_open(string stream, string path)
396 return ret; 396 return ret;
397 } 397 }
398 398
399 - if ((ret = write_flv_header()) != ERROR_SUCCESS) {  
400 - return ret; 399 + // when exists, donot write flv header.
  400 + if (tmp_flv_file != path) {
  401 + if ((ret = write_flv_header()) != ERROR_SUCCESS) {
  402 + return ret;
  403 + }
401 } 404 }
402 405
403 segment->path = path; 406 segment->path = path;