fix(libvideo2x): fix atomic int64_t frame_idx_ self add
Some checks failed
Build / ubuntu (push) Has been cancelled
Build / windows (push) Has been cancelled
Build / container (push) Has been cancelled
Build / appimage (push) Has been cancelled

Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
k4yt3x 2025-02-08 00:00:00 +00:00
parent 8803cf10a4
commit 445d13b73b
No known key found for this signature in database

View File

@ -262,7 +262,7 @@ int VideoProcessor::process_frames(
return ret; return ret;
} }
av_frame_unref(frame.get()); av_frame_unref(frame.get());
frame_idx_++; frame_idx_.fetch_add(1);
logger()->debug("Processed frame {}/{}", frame_idx_.load(), total_frames_.load()); logger()->debug("Processed frame {}/{}", frame_idx_.load(), total_frames_.load());
} }
} else if (enc_cfg_.copy_streams && stream_map[packet->stream_index] >= 0) { } else if (enc_cfg_.copy_streams && stream_map[packet->stream_index] >= 0) {
@ -274,12 +274,12 @@ int VideoProcessor::process_frames(
av_packet_unref(packet.get()); av_packet_unref(packet.get());
} }
// Flush the filter // Flush the processor
std::vector<AVFrame*> raw_flushed_frames; std::vector<AVFrame*> raw_flushed_frames;
ret = processor->flush(raw_flushed_frames); ret = processor->flush(raw_flushed_frames);
if (ret < 0) { if (ret < 0) {
av_strerror(ret, errbuf, sizeof(errbuf)); av_strerror(ret, errbuf, sizeof(errbuf));
logger()->critical("Error flushing filter: {}", errbuf); logger()->critical("Error flushing processor: {}", errbuf);
return ret; return ret;
} }
@ -295,7 +295,7 @@ int VideoProcessor::process_frames(
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
frame_idx_++; frame_idx_.fetch_add(1);
} }
// Flush the encoder // Flush the encoder
@ -314,7 +314,7 @@ int VideoProcessor::write_frame(AVFrame* frame, encoder::Encoder& encoder) {
int ret = 0; int ret = 0;
if (!benchmark_) { if (!benchmark_) {
ret = encoder.write_frame(frame, frame_idx_); ret = encoder.write_frame(frame, frame_idx_.load());
if (ret < 0) { if (ret < 0) {
av_strerror(ret, errbuf, sizeof(errbuf)); av_strerror(ret, errbuf, sizeof(errbuf));
logger()->critical("Error encoding/writing frame: {}", errbuf); logger()->critical("Error encoding/writing frame: {}", errbuf);
@ -437,7 +437,7 @@ int VideoProcessor::process_interpolation(
} }
} }
frame_idx_++; frame_idx_.fetch_add(1);
current_time_step += time_step; current_time_step += time_step;
} }