Dont copy pending mp4
This commit is contained in:
1 parent
84e2e65563
commit
896a07b5fa
3 files changed
+664
-17
No files matched your search
+19
-11
@@ -196,23 +196,31 @@ void VideoBatchWriter::shutdown() {
|
||||
if (writer_.isOpened()) {
|
||||
writer_.release();
|
||||
}
|
||||
|
||||
auto prev_state = state_;
|
||||
state_ = IDLE;
|
||||
|
||||
if (!current_path_.empty()) {
|
||||
std::string src = current_path_;
|
||||
std::string day_dir = output_dir_ + "/" + today_str();
|
||||
ensure_dir(day_dir);
|
||||
std::string dst = day_dir + "/" +
|
||||
fs::path(current_path_).filename().string();
|
||||
current_path_.clear();
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
close(STDIN_FILENO);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
copy_and_clean(src, dst);
|
||||
_exit(0);
|
||||
if (prev_state == CONFIRMED || prev_state == STOPPING) {
|
||||
std::string day_dir = output_dir_ + "/" + today_str();
|
||||
ensure_dir(day_dir);
|
||||
std::string dst = day_dir + "/" +
|
||||
fs::path(src).filename().string();
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
close(STDIN_FILENO);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
copy_and_clean(src, dst);
|
||||
_exit(0);
|
||||
}
|
||||
} else {
|
||||
std::error_code ec;
|
||||
fs::remove(src, ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user