X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=video_encoder.cpp;h=ec864d490dcdedfb67d3077ecc354d2856969d3a;hb=5eb4be2bd63d1590eac0e018f23bf00856b90194;hp=a622ba2af6640425d72dc5a72de44b4cc8f218e3;hpb=fdf765b229349a1d1a30414341957a4d10a0b6c9;p=nageru diff --git a/video_encoder.cpp b/video_encoder.cpp index a622ba2..ec864d4 100644 --- a/video_encoder.cpp +++ b/video_encoder.cpp @@ -136,14 +136,17 @@ void VideoEncoder::change_x264_bitrate(unsigned rate_kbit) void VideoEncoder::add_audio(int64_t pts, std::vector audio) { - lock_guard lock(qs_mu); - quicksync_encoder->add_audio(pts, audio); + { + lock_guard lock(qs_mu); + quicksync_encoder->add_audio(pts, audio); + } stream_audio_encoder->encode_audio(audio, pts + quicksync_encoder->global_delay()); } bool VideoEncoder::is_zerocopy() const { - lock_guard lock(qs_mu); + // Explicitly do _not_ take qs_mu; this is called from the mixer, + // and qs_mu might be contended. is_zerocopy() is thread safe. return quicksync_encoder->is_zerocopy(); }