mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Merge pull request #19802 from hrydgard/atrac3-workaround-packet-error
Atrac3 (not +): Keep decoding even on broken frames.
This commit is contained in:
@@ -95,8 +95,17 @@ public:
|
||||
result = atrac3_decode_frame(at3Ctx_, buffers_, &nb_samples, inbuf, inbytes);
|
||||
}
|
||||
if (result < 0) {
|
||||
// NOTE: Here, to recover from single bad packets, we update inBytesConsumed/outSamples with the regular packet size.
|
||||
// Otherwise we might try to decode the same packet over and over.
|
||||
// This is seen in some unofficial game mods, mainly.
|
||||
if (inbytesConsumed) {
|
||||
*inbytesConsumed = inbytes;
|
||||
}
|
||||
if (outSamples) {
|
||||
*outSamples = 0;
|
||||
if (*outSamples != 0) {
|
||||
nb_samples = std::min(*outSamples, nb_samples);
|
||||
}
|
||||
*outSamples = nb_samples;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -755,13 +755,14 @@ int atrac3_decode_frame(ATRAC3Context *ctx, float *out_data[2], int *nb_samples,
|
||||
databuf = buf;
|
||||
}
|
||||
|
||||
*nb_samples = SAMPLES_PER_FRAME;
|
||||
|
||||
ret = decode_frame(ctx, block_align, channels, databuf, out_data);
|
||||
if (ret) {
|
||||
av_log(AV_LOG_ERROR, "Frame decoding error!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
*nb_samples = SAMPLES_PER_FRAME;
|
||||
return block_align;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user