]> git.sesse.net Git - nageru/blobdiff - futatabi/main.cpp
If the Futatabi source URL is empty or /dev/null, don't bother trying to open it.
[nageru] / futatabi / main.cpp
index 3146aa52d5eb2f55bf6d0fd0ca9adede42fab95f..3efefd5e94a1a279c751e970fa8b27be69485f16 100644 (file)
@@ -183,7 +183,7 @@ FrameOnDisk write_frame(int stream_idx, int64_t pts, const uint8_t *data, size_t
 HTTPD *global_httpd;
 
 void load_existing_frames();
-int record_thread_func();
+void record_thread_func();
 
 int main(int argc, char **argv)
 {
@@ -367,11 +367,12 @@ void load_frame_file(const char *filename, const string &basename, unsigned file
        }
 
        off_t size = ftell(fp);
+       fclose(fp);
+
        if (size == -1) {
                fprintf(stderr, "WARNING: %s: ftell() failed (%s).\n", filename, strerror(errno));
                return;
        }
-       fclose(fp);
 
        db->store_frame_file(basename, size, all_frames);
 }
@@ -450,8 +451,13 @@ void load_existing_frames()
        db.clean_unused_frame_files(frame_basenames);
 }
 
-int record_thread_func()
+void record_thread_func()
 {
+       if (global_flags.stream_source.empty() || global_flags.stream_source == "/dev/null") {
+               // Save the user from some repetitive messages.
+               return;
+       }
+
        pthread_setname_np(pthread_self(), "ReceiveFrames");
 
        int64_t pts_offset;
@@ -511,5 +517,4 @@ int record_thread_func()
 
                start_pts = last_pts + TIMEBASE;
        }
-       return 0;
 }