cellMusicDecode: fix track index on next if already on last track

Fixes an OOB exception
This commit is contained in:
Megamouse 2026-06-01 02:42:02 +02:00
parent fa1aa9dcf3
commit f8a5a6ad93
3 changed files with 12 additions and 2 deletions

View File

@ -387,6 +387,12 @@ error_code cellMusicDecodeSetDecodeCommand(s32 command)
return CELL_OK; return CELL_OK;
}); });
//sysutil_register_cb([&dec, command](ppu_thread& ppu) -> s32
//{
// dec.func(ppu, CELL_MUSIC_DECODE_EVENT_STATUS_NOTIFICATION, vm::addr_t(command), dec.userData);
// return CELL_OK;
//});
return CELL_OK; return CELL_OK;
} }

View File

@ -301,7 +301,7 @@ u32 music_selection_context::step_track(bool next)
{ {
// We are at the end of the playlist. // We are at the end of the playlist.
cellMusicSelectionContext.notice("step_track: No more tracks to play in playlist..."); cellMusicSelectionContext.notice("step_track: No more tracks to play in playlist...");
current_track = umax; current_track = playlist.size() - 1; // NOTE: We could use size instead of size - 1 to allow to use PREV to play the last track again.
return umax; return umax;
} }
} }

View File

@ -477,6 +477,8 @@ namespace utils
void audio_decoder::clear() void audio_decoder::clear()
{ {
media_log.notice("audio_decoder: Clear data...");
track_fully_decoded = 0; track_fully_decoded = 0;
track_fully_consumed = 0; track_fully_consumed = 0;
has_error = false; has_error = false;
@ -487,6 +489,8 @@ namespace utils
void audio_decoder::stop() void audio_decoder::stop()
{ {
media_log.notice("audio_decoder: Stop decoding...");
if (m_thread) if (m_thread)
{ {
auto& thread = *m_thread; auto& thread = *m_thread;
@ -695,7 +699,7 @@ namespace utils
if (buffer) if (buffer)
av_freep(&buffer); av_freep(&buffer);
media_log.notice("audio_decoder: decoded frame_count=%d buffer_size=%d timestamp_us=%d", frame_count, buffer_size, av.audio.frame->best_effort_timestamp); media_log.trace("audio_decoder: decoded frame_count=%d buffer_size=%d timestamp_us=%d", frame_count, buffer_size, av.audio.frame->best_effort_timestamp);
} }
} }
}; };