atrac3: give the decoder its frame size for RM files

Since 2e314093c8 the ATRAC3 decoder takes its frame size from
id3->bytesperframe, which the RM metadata parser does not set. With
a frame size of zero, a file in plain stereo mode had its second
channel decoded from the first channel's data: both outputs were
the left channel.

Set it from the RM sub packet size before the decoder is opened.

Checked with perfsim (Sansa e200v1 build) on six ATRAC3 .rm files:
the two channels were identical sample for sample before, and each
now follows its own channel of ffmpeg's decode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michael Giacomelli 2026-10-06 01:11:45 -04:00
parent dcee3ce62f
commit f1d7ae3bbf

View file

@ -107,6 +107,10 @@ enum codec_status codec_run(void)
scrambling_unit_size = h * (fs + packet_header_size);
spn = h * fs / sps;
/* The decoder takes its frame size from the id3, which the RM
* metadata parser does not fill in. */
ci->id3->bytesperframe = sps;
res = atrac3_decode_init(&q, ci->id3, rmctx.nb_channels, rmctx.extradata_size);
if(res < 0) {
DEBUGF("failed to initialize RM atrac decoder\n");