mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #19802 from hrydgard/atrac3-workaround-packet-error
Atrac3 (not +): Keep decoding even on broken frames.
This commit is contained in:
commit
9f42ef62d7
2 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue