mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine dvr, append file when dvr file exists. 2.0.122.
This commit is contained in:
parent
1102c7a58f
commit
a984eeecab
10 changed files with 79 additions and 17 deletions
|
@ -69,6 +69,30 @@ int SrsFileWriter::open(string file)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsFileWriter::open_append(string file)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (fd > 0) {
|
||||
ret = ERROR_SYSTEM_FILE_ALREADY_OPENED;
|
||||
srs_error("file %s already opened. ret=%d", _file.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int flags = O_APPEND|O_WRONLY;
|
||||
mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH;
|
||||
|
||||
if ((fd = ::open(file.c_str(), flags, mode)) < 0) {
|
||||
ret = ERROR_SYSTEM_FILE_OPENE;
|
||||
srs_error("open file %s failed. ret=%d", file.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
_file = file;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SrsFileWriter::close()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue