OSDN Git Service

[Qt][MOVIE_SAVER] Fix timing of sending video frame(s).
authorK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 16 Jun 2016 14:45:30 +0000 (23:45 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 16 Jun 2016 14:45:30 +0000 (23:45 +0900)
source/src/qt/avio/movie_saver_fileio.cpp
source/src/qt/osd_screen.cpp
source/src/qt/osd_sound.cpp

index 4f240c7..955c484 100644 (file)
@@ -227,7 +227,7 @@ bool MOVIE_SAVER::do_open(QString filename, int _fps, int _sample_rate)
        {
                QString value;
                do_clear_options_list();
-               do_add_option(QString::fromUtf8("c:v"), QString::fromUtf8("libx264"));
+               do_add_option(QString::fromUtf8("c:v"), QString::fromUtf8("mpeg4"));
                do_add_option(QString::fromUtf8("c:a"), QString::fromUtf8("aac"));
                //do_add_option(QString::fromUtf8("c:v"), QString::fromUtf8("theora"));
                //do_add_option(QString::fromUtf8("c:a"), QString::fromUtf8("vorbis"));
index 156b42e..068d208 100644 (file)
@@ -283,7 +283,7 @@ int OSD_BASE::add_video_frames()
        static double prev_vm_fps = -1;
        double vm_fps = vm_frame_rate();
        frames = vm_fps / (double)rec_video_fps;
-       
+
        while(rec_video_run_frames > 0) {
                rec_video_run_frames -= frames;
                rec_video_frames += frames;
@@ -292,7 +292,7 @@ int OSD_BASE::add_video_frames()
        if(frames <= 1.0) {
                if(counter <= 0) return counter;
        } else {
-               counter = counter + ((int)frames - 1);
+               counter = counter + (int)frames;
        }
        if(using_flags->is_use_one_board_computer()) {
                int size = vm_screen_buffer.pImage.byteCount();
index a1d559c..0342101 100644 (file)
@@ -226,10 +226,10 @@ void OSD_BASE::update_sound(int* extra_frames)
                                        frames = fps * (double)samples / (double)sound_rate;
                                        //}
                                        rec_video_frames -= frames;
-                                       if(rec_video_frames > 2) {
-                                               rec_video_run_frames -= (rec_video_frames - 2);
-                                       } else if(rec_video_frames < -2) {
-                                               rec_video_run_frames -= (rec_video_frames + 2);
+                                       if(rec_video_frames > 2.0) {
+                                               rec_video_run_frames -= (rec_video_frames - 2.0);
+                                       } else if(rec_video_frames < -2.0) {
+                                               rec_video_run_frames -= (rec_video_frames + 2.0);
                                        }
                                }
                                //printf("Wrote %d samples ptr=%d\n", samples, rec_sound_buffer_ptr);