audio_frame2::change_ch_count: fix CID 480257

the behavior is now very slightly modified but effectively the same,
eg. change 1 to 3 channels copies now channel 0 to 1 and then 1 to 2
(before it copies 0 to both 1 and 2).
This commit is contained in:
Martin Pulec
2025-04-10 11:59:22 +02:00
parent 94665c52fb
commit eea61b2604

View File

@@ -347,8 +347,8 @@ void audio_frame2::change_ch_count(int ch_count)
return;
}
const channel &last_ch = channels.at(channels.size() - 1);
for (unsigned i = channels.size(); i < (unsigned) ch_count; ++i) {
const channel &last_ch = channels.at(channels.size() - 1);
std::unique_ptr<char[]> data =
std::unique_ptr<char[]>(new char[last_ch.len]);
memcpy(data.get(), last_ch.data.get(), last_ch.len);