Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ namespace video {
avcodec_encode_session_t(avcodec_encode_session_t &&other) noexcept = default;

~avcodec_encode_session_t() {
// Flush any remaining frames in the encoder
if (avcodec_send_frame(avcodec_ctx.get(), nullptr) == 0) {
// Flush any remaining frames in the encoder if the encoder started up (frame num > delay)
if (avcodec_ctx->frame_num > avcodec_ctx->delay && avcodec_send_frame(avcodec_ctx.get(), nullptr) == 0) {
packet_raw_avcodec pkt;
while (avcodec_receive_packet(avcodec_ctx.get(), pkt.av_packet) == 0);
}
Expand Down