1
0
Fork 0
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:
winlin 2015-02-19 19:50:10 +08:00
parent 1102c7a58f
commit a984eeecab
10 changed files with 79 additions and 17 deletions

View file

@ -230,10 +230,8 @@ int __srs_create_dir_recursively(string dir)
{
int ret = ERROR_SUCCESS;
struct stat st;
// stat current dir, if exists, return error.
if (stat(dir.c_str(), &st) == 0) {
if (srs_path_exists(dir)) {
return ERROR_SYSTEM_DIR_EXISTS;
}
@ -279,6 +277,18 @@ int srs_create_dir_recursively(string dir)
return ret;
}
bool srs_path_exists(std::string path)
{
struct stat st;
// stat current dir, if exists, return error.
if (stat(path.c_str(), &st) == 0) {
return true;
}
return false;
}
bool srs_avc_startswith_annexb(SrsStream* stream, int* pnb_start_code)
{
char* bytes = stream->data() + stream->pos();