2026-09-13 16:21:42

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie
2026-09-13 16:21:42 +00:00
parent df874a62a9
commit 72a270fb3a
@@ -142,7 +142,8 @@ public:
if ((r = avcodec_send_packet(avc, pkt)) >= 0) {
int rem_output_bytes = int(output_data_size);
av_frame_unref(frame);
while ((r = avcodec_receive_frame(avc, frame)) >= 0) {
do {
r = avcodec_receive_frame(avc, frame);
auto const input_bsize = av_samples_get_buffer_size(frame->linesize, frame->ch_layout.nb_channels, frame->nb_samples, AV_SAMPLE_FMT_S16, 1);
ASSERT(rem_output_bytes - input_bsize >= 0);
auto const dst_data = reinterpret_cast<s16*>(output_data + (int(output_data_size) - rem_output_bytes));
@@ -162,10 +163,12 @@ public:
out_sample_count += frame->nb_samples;
rem_output_bytes -= input_bsize;
av_frame_unref(frame);
}
if (r == AVERROR_EOF) {
LOG_WARNING(Audio_DSP, "eof");
} while (r >= 0 && rem_output_bytes > 0);
if (r == AVERROR(EAGAIN) || r == AVERROR_EOF) {
// non-errors
LOG_DEBUG(Audio_DSP, "{}", r);
} else if (r < 0) {
// errors
LOG_ERROR(Audio_DSP, "{}", r);
}
ASSERT(rem_output_bytes == 0 && "remaining bytes!");