Skip to content
This repository

[osx] fixed: incorrect mFormatFlags set for S16LE #976

Merged
merged 1 commit into from almost 2 years ago

2 participants

Anssi Hannula Memphiz
Anssi Hannula
Collaborator
anssih commented May 17, 2012

CCoreAudioUnit::GetFormatDesc() currently sets
kAudioFormatFlagsNativeEndian for AE_FMT_S16LE.

However, S16LE is always little-endian, not native-endian, so that flag
shouldn't be set.

This incorrect value presumably didn't cause widespread issues because
on little-endian systems S16LE is also native-endian, so the code did
nothing (as kAudioFormatFlagsNativeEndian is zero), and on big-endian
systems we normally output S16BE instead of S16LE, so the codepath was
not hit.

Note that I haven't tested this, just noticed the bug when looking at the code.
So please check everything still works before pulling :)

Anssi Hannula [osx] fixed: incorrect mFormatFlags set for S16LE
CCoreAudioUnit::GetFormatDesc() currently sets
kAudioFormatFlagsNativeEndian for AE_FMT_S16LE.

However, S16LE is always little-endian, not native-endian, so that flag
shouldn't be set.

This incorrect value presumably didn't cause widespread issues because
on little-endian systems S16LE is also native-endian, so the code did
nothing (as kAudioFormatFlagsNativeEndian is zero), and on big-endian
systems we normally output S16BE instead of S16LE, so the codepath was
not hit.
35e3ba0
Memphiz
Owner

Sounds right to me as of your description.

Anssi Hannula anssih merged commit 6380a84 into from July 10, 2012
Anssi Hannula anssih closed this July 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 17, 2012
Anssi Hannula [osx] fixed: incorrect mFormatFlags set for S16LE
CCoreAudioUnit::GetFormatDesc() currently sets
kAudioFormatFlagsNativeEndian for AE_FMT_S16LE.

However, S16LE is always little-endian, not native-endian, so that flag
shouldn't be set.

This incorrect value presumably didn't cause widespread issues because
on little-endian systems S16LE is also native-endian, so the code did
nothing (as kAudioFormatFlagsNativeEndian is zero), and on big-endian
systems we normally output S16BE instead of S16LE, so the codepath was
not hit.
35e3ba0
This page is out of date. Refresh to see the latest.
1  xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHALIOS.cpp
@@ -311,7 +311,6 @@ void CCoreAudioUnit::GetFormatDesc(AEAudioFormat format,
311 311
       streamDesc->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
312 312
       break;
313 313
     case AE_FMT_S16LE:
314  
-      streamDesc->mFormatFlags |= kAudioFormatFlagsNativeEndian;
315 314
       streamDesc->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
316 315
       break;
317 316
     case AE_FMT_S16BE:
1  xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioUnit.cpp
@@ -314,7 +314,6 @@ void CCoreAudioUnit::GetFormatDesc(AEAudioFormat format,
314 314
       streamDesc->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
315 315
       break;
316 316
     case AE_FMT_S16LE:
317  
-      streamDesc->mFormatFlags |= kAudioFormatFlagsNativeEndian;
318 317
       streamDesc->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
319 318
       break;
320 319
     case AE_FMT_S16BE:
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.