X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fav1_encoder.cpp;h=ca9f7c3d4f34480727a238bfe2ad65dc7ebab7be;hb=ca385fbb8f5035053e372e9f0aeaa5579aee83e2;hp=f4af4b0c4031e918fe282c15e943c13cf36104b9;hpb=cecd32b340ef23498d31095bfb4bb17f5877af7e;p=nageru diff --git a/nageru/av1_encoder.cpp b/nageru/av1_encoder.cpp index f4af4b0..ca9f7c3 100644 --- a/nageru/av1_encoder.cpp +++ b/nageru/av1_encoder.cpp @@ -132,6 +132,14 @@ void AV1Encoder::add_frame(int64_t pts, int64_t duration, YCbCrLumaCoefficients void AV1Encoder::init_av1() { EbSvtAv1EncConfiguration config; + + // svt_av1_enc_init_handle() is defined to fill config with the defaults; + // yet, seemingly, not everything is written, and some of it can cause + // Valgrind warnings and/or crashes. It should never hurt to put it + // into a known state beforehand, and it seems to fix the crashes, + // so we do that. + memset(&config, 0, sizeof(config)); + EbErrorType ret = svt_av1_enc_init_handle(&encoder, nullptr, &config); if (ret != EB_ErrorNone) { fprintf(stderr, "Error initializing SVT-AV1 handle (error %08x)\n", ret); @@ -158,9 +166,7 @@ void AV1Encoder::init_av1() config.matrix_coefficients = EB_CICP_MC_BT_601; } config.color_range = EB_CR_STUDIO_RANGE; -#if SVT_AV1_CHECK_VERSION(1, 0, 0) config.chroma_sample_position = EB_CSP_VERTICAL; -#endif const vector &extra_param = global_flags.av1_extra_param; for (const string &str : extra_param) {