-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Code Lyoko audio softlock (now: bad playback) #19994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Xibancry |
Yes, it's on sector 5 for the savefile I sent. It's not the only place it happens |
Media log easier to check 18:26:659 ATRAC3 Load D[ME]: HLE\AtracCtx.cpp:235 ATRAC analyzed: AT3Plus channels: 2 filesize: 70164 bitrate: 94 kbps jointStereo: 0 ATRAC3 related |
Even v1.16.6 don't softlock, the voice has some problem |
v1.17.1-264 good |
git bisect result: a1ac79c |
Thank you for the bisect, not surprising, it's when we switched the decoder to not use ffmpeg. I think this is another case of not detecting mono properly, so the decoder tries to parse it as stereo and fails. Will need to figure out how it worked before.. |
@hrydgard Before it cannot decode mono correctly , but it do not have error . |
@hrydgard I have a idea. For streamed ATRAC3+ , I think that we do not change track_.channels , so it assume stereo. |
Force to change to mono still fail. if (!decoder_->Decode(indata, track_.bytesPerFrame, &bytesConsumed, outputChannels_, (int16_t*)outbuf, &outSamples)) {
track_.channels = 1;
if (!decoder_->Decode(indata, track_.bytesPerFrame, &bytesConsumed, outputChannels_, (int16_t*)outbuf, &outSamples)) {
// Decode failed.
*SamplesNum = 0;
*finish = 1;
return ATRAC_ERROR_ALL_DATA_DECODED;
}
} |
Ignore decode error can work around....Before v1.19 release make the hack ? |
If we can't fix it, yeah. |
Now we don't generate an error code when the channel configuration doesn't match the packets. See the code comment for what I've been able to figure out so far. See issue #19994
#20005 will probably work as a workaround, but I don't think it'll fix broken audio.. Something is really going wrong in decoding here. |
#20005 work as a workaround |
Jpcsp emulator log edit: From JPCSP emulator log, channels=2 all the times |
Hm. Might have to dig into how JPCSP handles this then... Thanks for letting me know. |
Can you code (logging) the data of the "data chunk" in PPSPPP so that I can compare it in JPCSP emulator ? 5:05:40 DEBUG hle.sceAtrac3plus - ATRAC3 Load thread - sceAtracSetDataAndGetID buffer=0x08A5C340, bufferSize=0x800 |
Probably because you can get compilation error when declaring and initializing a variable inside |
It's nicer to have the break inside the {} of the case, but it doesn't really matter. I'll look into this more in a little while. |
Hm, jpcsp seems to handle the channel blocks exactly the same: Wonder what is different.. |
edit last: I know what is the problem |
Easy to compare JPCSP emulator log. Debugging in hrydgard#19994
So what is it? :) I merged your logging change. |
Updated PPSSPP log: |
After update source, debug build (VS2022): |
edit : What is actual decode data address and size in Atrac::DecodeData() ? |
So the error maybe in sceAtracGetStreamDataInfo() |
I don't know if I'm having the same problem. But I'll describe it shortly here: (I'm running a freshly compiled ecbbadd (HEAD from two days ago) via a freshly compiled RetroArch. I'm using the Vulkan backend for video, PipeWire for audio on Linux, debian testing.) With a lot of games, the PPSSPP core appears to lock up (makes no progress). It burns ~100% CPU. I took a perf profile: So it appears to be stuck decoding some audio. If it's not the same problem, I can try to supply more information. (There are no logs in Differently to OP, for me the sotflock happens on a lot of different ROMs I tried (not all, OutRun 2006 Coast to Coast appears to work well most of the time.) |
A hang inside decodeframe is very unexpected. But stay tuned, there will soon be a big update to atrac handling in general (#20098 ). |
OK, I guess I'll check it out once new code lands. Compiling HEAD from yesterday in debug mode, I can tell the softlock comes from a combination of:
The segfault happens here (according to gdb):
I decide to move to the next instruction, which is the
Then see where it goes in the handler:
We're now here:
Since 128 is neither 1 nor 2, we return and the process begins a new, spinning at 100% CPU. The C code surrounding the crash is:
│ 642
│ 643 /* append the result to the history */
│ 644 const int hist_pos = hist->pos;
│ 645 for (i = 0; i < 8; i++) {
│ 646 hist->buf1[hist_pos][i] = idct_out[i + 8];
│ 647 }
│ 648 for (i = 0; i < 8; i++) {
│ > 649 hist->buf2[hist_pos][i] = idct_out[7 - i];
│ 650 } The │ 0x7eff164908c8 <_Z15ff_atrac3p_ipqfP10FFTContextP21Atrac3pIPQFChannelCtxPKfPf+232> vpermd 0x40(%rsp),%ymm4,%ymm0
│ 0x7eff164908cf <_Z15ff_atrac3p_ipqfP10FFTContextP21Atrac3pIPQFChannelCtxPKfPf+239> mov (%rbx,%rax,4),%edi
│ >0x7eff164908d2 <_Z15ff_atrac3p_ipqfP10FFTContextP21Atrac3pIPQFChannelCtxPKfPf+242> vmovaps %ymm0,0x300(%r15,%rsi,1)
│ 0x7eff164908dc <_Z15ff_atrac3p_ipqfP10FFTContextP21Atrac3pIPQFChannelCtxPKfPf+252> lea 0x726d1d(%rip),%rsi # 0x7eff16bb7600 <_ZL12ipqf_coeffs2>
│ 0x7eff164908e3 <_Z15ff_atrac3p_ipqfP10FFTContextP21Atrac3pIPQFChannelCtxPKfPf+259> vmovups (%r14),%xmm3
│ 0x7eff164908e8 <_Z15ff_atrac3p_ipqfP10FFTContextP21Atrac3pIPQFChannelCtxPKfPf+264> vmovups 0x10(%r14),%xmm2 │ It looks like the compiler (gcc in my case) vectorized the snot out of his. It's hard to read. I can't even tell without squinting whether it's readin gfrom
It's a little bit odd that one side is
I did not expect a null dereference, and I'm wondering if there isn't some shenanigangs going on due to
Our address is somewhat close to the end of the mapping. The stack is apparently
Remembering the
The
At this point I ran out of time, maybe later in the week. |
I can confirm that the infinite loop through segfault is gone. |
Game or games this happens in
ULES-01095 - Code Lyoko: Quest for Infinity
What area of the game / PPSSPP
Many areas affected. Only when some voice audio tracks play. The text box showing dialogue appears but it fails to play the voice audio preventing it from closing and effectively softlocking the game everytime it happens (this is apparently consistent with some dialogues). Only solution around it is to reset the game.
Adding a savefile previous to softlock. Softlock occurs on the third dialogue just after defeating the first enemy in the level.
ULES01095DATA00.zip
What should happen
The game should play the dialogue normally without preventing the dialogue box from closing and not softlocking the game.
Logs
ppsspplog.txt
Platform
Windows
Mobile device model or graphics card (GPU)
RTX 2080 Super
PPSSPP version affected
v1.18.1 - 0f50225
Last working version
v1.16.6
Graphics backend (3D API)
Direct3D 11
Checklist
The text was updated successfully, but these errors were encountered: