]> git.sesse.net Git - nageru/blobdiff - nageru/kaeru.cpp
Move protobuf text serialization into a shared file.
[nageru] / nageru / kaeru.cpp
index 390e3cc5f7754c092baa32131a79f595943b00d1..9d9738391082a484cf3338361c2746aff1aa5ec7 100644 (file)
@@ -73,7 +73,7 @@ unique_ptr<Mux> create_mux(HTTPD *httpd, AVOutputFormat *oformat, X264Encoder *x
 
        unique_ptr<Mux> mux;
        mux.reset(new Mux(avctx, global_flags.width, global_flags.height, Mux::CODEC_H264, video_extradata, audio_encoder->get_codec_parameters().get(),
-               get_color_space(global_flags.ycbcr_rec709_coefficients), Mux::WITH_AUDIO, COARSE_TIMEBASE,
+               get_color_space(global_flags.ycbcr_rec709_coefficients), COARSE_TIMEBASE,
                /*write_callback=*/nullptr, Mux::WRITE_FOREGROUND, { &stream_mux_metrics }));
        stream_mux_metrics.init({{ "destination", "http" }});
        return mux;
@@ -91,7 +91,7 @@ void video_frame_callback(FFmpegCapture *video, X264Encoder *x264_encoder, Audio
                ts.ts.push_back(steady_clock::now());
 
                video_pts = av_rescale_q(video_pts, video_timebase, AVRational{ 1, TIMEBASE });
-               int64_t frame_duration = TIMEBASE * video_format.frame_rate_den / video_format.frame_rate_nom;
+               int64_t frame_duration = int64_t(TIMEBASE) * video_format.frame_rate_den / video_format.frame_rate_nom;
                x264_encoder->add_frame(video_pts, frame_duration, video->get_current_frame_ycbcr_format().luma_coefficients, video_frame.data + video_offset, ts);
                global_basic_stats->update(frame_num++, /*dropped_frames=*/0);
        }
@@ -225,6 +225,7 @@ int main(int argc, char *argv[])
 
        video.stop_dequeue_thread();
        // Stop the x264 encoder before killing the mux it's writing to.
+       global_x264_encoder = nullptr;
        x264_encoder.reset();
        return 0;
 }