From f61a941e83e83aaa69b84fd73fd35f7d711d17b5 Mon Sep 17 00:00:00 2001 From: loki Date: Sat, 18 Jan 2020 11:33:16 +0100 Subject: [PATCH] Use BOOST_LOG instead of printf --- sunshine/video.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sunshine/video.cpp b/sunshine/video.cpp index 11eb886f..de6886e0 100644 --- a/sunshine/video.cpp +++ b/sunshine/video.cpp @@ -61,19 +61,22 @@ void encode(int64_t frame, ctx_t &ctx, sws_t &sws, frame_t &yuv_frame, platf::im /* send the frame to the encoder */ ret = avcodec_send_frame(ctx.get(), yuv_frame.get()); if (ret < 0) { - fprintf(stderr, "error sending a frame for encoding\n"); - exit(1); + BOOST_LOG(fatal) << "Could not send a frame for encoding"sv; + log_flush(); + std::abort(); } while (ret >= 0) { packet_t packet { av_packet_alloc() }; ret = avcodec_receive_packet(ctx.get(), packet.get()); - if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { return; + } else if (ret < 0) { - fprintf(stderr, "error during encoding\n"); - exit(1); + BOOST_LOG(fatal) << "Could not encode video packet"sv; + log_flush(); + std::abort(); } packets->raise(std::move(packet));