X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=kaeru.cpp;h=11fea00c91842cb3be956b225c414cc71491dacb;hb=e5a0d3dfb676087bdcef4c82876234782e46604c;hp=6d98cce1791992a47df17663b77d5159169061fd;hpb=b9f32b108b1e3392d1ca6884f3c960f18acaa0d6;p=nageru diff --git a/kaeru.cpp b/kaeru.cpp index 6d98cce..11fea00 100644 --- a/kaeru.cpp +++ b/kaeru.cpp @@ -50,7 +50,7 @@ int write_packet(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType ty stream_mux_header.append((char *)buf, buf_size); httpd->set_header(stream_mux_header); } else { - httpd->add_data((char *)buf, buf_size, type == AVIO_DATA_MARKER_SYNC_POINT); + httpd->add_data((char *)buf, buf_size, type == AVIO_DATA_MARKER_SYNC_POINT, time, AVRational{ AV_TIME_BASE, 1 }); } return buf_size; } @@ -69,8 +69,7 @@ unique_ptr create_mux(HTTPD *httpd, AVOutputFormat *oformat, X264Encoder *x string video_extradata = x264_encoder->get_global_headers(); unique_ptr mux; - int time_base = global_flags.stream_coarse_timebase ? COARSE_TIMEBASE : TIMEBASE; - mux.reset(new Mux(avctx, global_flags.width, global_flags.height, Mux::CODEC_H264, video_extradata, audio_encoder->get_codec_parameters().get(), time_base, + mux.reset(new Mux(avctx, global_flags.width, global_flags.height, Mux::CODEC_H264, video_extradata, audio_encoder->get_codec_parameters().get(), COARSE_TIMEBASE, /*write_callback=*/nullptr, Mux::WRITE_FOREGROUND, { &stream_mux_metrics })); stream_mux_metrics.init({{ "destination", "http" }}); return mux; @@ -130,7 +129,7 @@ void video_frame_callback(FFmpegCapture *video, X264Encoder *x264_encoder, Audio void audio_frame_callback(Mux *mux, const AVPacket *pkt, AVRational timebase) { - mux->add_packet(*pkt, pkt->pts, pkt->dts == AV_NOPTS_VALUE ? pkt->pts : pkt->dts, timebase); + mux->add_packet(*pkt, pkt->pts, pkt->dts == AV_NOPTS_VALUE ? pkt->pts : pkt->dts, timebase, /*stream_index=*/1); } void adjust_bitrate(int signal) @@ -206,7 +205,7 @@ int main(int argc, char *argv[]) video.start_bm_capture(); video.change_rate(2.0); // Be sure never to really fall behind, but also don't dump huge amounts of stuff onto x264. - BasicStats basic_stats(/*verbose=*/false); + BasicStats basic_stats(/*verbose=*/false, /*use_opengl=*/false); global_basic_stats = &basic_stats; httpd.start(global_flags.http_port);