From: Steinar H. Gunderson Date: Sun, 4 Apr 2021 11:41:29 +0000 (+0200) Subject: Stop decoding video/audio in FFmpegCapture if we are not going to use the decoded... X-Git-Tag: 2.0.2~8 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e463f05db81538dedceb8d0eaac59bb622cb76e5;p=nageru Stop decoding video/audio in FFmpegCapture if we are not going to use the decoded information anyway. --- diff --git a/nageru/ffmpeg_capture.cpp b/nageru/ffmpeg_capture.cpp index 0a328e0..4b9d54f 100644 --- a/nageru/ffmpeg_capture.cpp +++ b/nageru/ffmpeg_capture.cpp @@ -848,13 +848,13 @@ AVFrameWithDeleter FFmpegCapture::decode_frame(AVFormatContext *format_ctx, AVCo if (pkt.stream_index == video_stream_index && video_callback != nullptr) { video_callback(&pkt, format_ctx->streams[video_stream_index]->time_base); } - if (pkt.stream_index == video_stream_index) { + if (pkt.stream_index == video_stream_index && global_flags.transcode_video) { if (avcodec_send_packet(video_codec_ctx, &pkt) < 0) { fprintf(stderr, "%s: Cannot send packet to video codec.\n", pathname.c_str()); *error = true; return AVFrameWithDeleter(nullptr); } - } else if (pkt.stream_index == audio_stream_index) { + } else if (pkt.stream_index == audio_stream_index && global_flags.transcode_audio) { has_audio = true; if (avcodec_send_packet(audio_codec_ctx, &pkt) < 0) { fprintf(stderr, "%s: Cannot send packet to audio codec.\n", pathname.c_str());