]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Decide pts in the mixer instead of in the encoder.
[nageru] / mixer.cpp
index 69eebe07905196e024ae4bf0708fc53b2629d6b7..5b2d0da6324eb6e2485a8674afb182a44b75b575 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -41,6 +41,7 @@
 #include "h264encode.h"
 #include "pbo_frame_allocator.h"
 #include "ref_counted_gl_sync.h"
+#include "timebase.h"
 
 class QOpenGLContext;
 
@@ -95,7 +96,7 @@ Mixer::Mixer(const QSurfaceFormat &format)
        display_chain->set_dither_bits(0);  // Don't bother.
        display_chain->finalize();
 
-       h264_encoder.reset(new H264Encoder(h264_encoder_surface, WIDTH, HEIGHT, "test.mkv"));
+       h264_encoder.reset(new H264Encoder(h264_encoder_surface, WIDTH, HEIGHT, "test.mp4"));
 
        for (int card_index = 0; card_index < NUM_CARDS; ++card_index) {
                printf("Configuring card %d...\n", card_index);
@@ -321,7 +322,7 @@ void Mixer::thread_func()
                for (int card_index = 0; card_index < NUM_CARDS; ++card_index) {
                        input_frames.push_back(bmusb_current_rendering_frame[card_index]);
                }
-               h264_encoder->end_frame(fence, move(samples_out), input_frames);
+               h264_encoder->end_frame(fence, frame * (TIMEBASE / 60), move(samples_out), input_frames);
 
                // The live frame just shows the RGBA texture we just rendered.
                // It owns rgba_tex now.