citra-emu
/
citra-canary
Archived
1
0
Fork 0

audio_core: hle: mf: fix a regression...

... where the sample copying logic is incorrect due to the wrong usage
of `std::array`
This commit is contained in:
liushuyu 2019-02-08 21:22:14 -07:00 committed by B3N30
parent 6332e57069
commit c91f5029ff
3 changed files with 7 additions and 5 deletions

View File

@ -16,8 +16,8 @@ struct ADTSData {
u32 samplerate;
};
ADTSData ParseADTS(char* buffer);
ADTSData ParseADTS(const char* buffer);
// last two bytes of MF AAC decoder user data
// see https://docs.microsoft.com/en-us/windows/desktop/medfound/aac-decoder#example-media-types
u16 MFGetAACTag(ADTSData input);
u16 MFGetAACTag(const ADTSData input);

View File

@ -8,7 +8,7 @@ constexpr std::array<u32, 16> freq_table = {96000, 88200, 64000, 48000, 44100, 3
16000, 12000, 11025, 8000, 7350, 0, 0, 0};
constexpr std::array<u8, 8> channel_table = {0, 1, 2, 3, 4, 5, 6, 8};
ADTSData ParseADTS(char* buffer) {
ADTSData ParseADTS(const char* buffer) {
u32 tmp = 0;
ADTSData out;
@ -50,7 +50,7 @@ ADTSData ParseADTS(char* buffer) {
// Frame length flag (1 bit)
// Depends on core coder (1 bit)
// Extension flag (1 bit)
u16 MFGetAACTag(ADTSData input) {
u16 MFGetAACTag(const ADTSData input) {
u16 tag = 0;
tag |= input.profile << 11;

View File

@ -116,12 +116,14 @@ MFOutputState WMFDecoder::Impl::DecodingLoop(ADTSData adts_header,
// the following was taken from ffmpeg version of the decoder
f32 val_f32;
for (size_t i = 0; i < output_buffer->size(); i++) {
for (size_t i = 0; i < output_buffer->size(); ) {
for (std::size_t channel = 0; channel < adts_header.channels; channel++) {
val_f32 = output_buffer->at(i);
s16 val = static_cast<s16>(0x7FFF * val_f32);
out_streams[channel].push_back(val & 0xFF);
out_streams[channel].push_back(val >> 8);
// i is incremented on per channel basis
i++;
}
}
}