Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioTrack: Workarounds #10809

Merged
merged 2 commits into from Oct 31, 2016
Merged

AudioTrack: Workarounds #10809

merged 2 commits into from Oct 31, 2016

Conversation

fritsch
Copy link
Member

@fritsch fritsch commented Oct 29, 2016

Yet another bunch of workarounds for broken firmware. This time AFTV2 via: http://forum.kodi.tv/showthread.php?tid=295014&pid=2446406#pid2446406

@fritsch
Copy link
Member Author

fritsch commented Oct 29, 2016

jenkins build this please

@fritsch fritsch added the Type: Fix non-breaking change which fixes an issue label Oct 29, 2016
@MrMC
Copy link

MrMC commented Oct 29, 2016

how does a requested sample rate of 22050 get past the check at line 247 when the min supported sink sample rate is 32000 ?

AESinkAUDIOTRACK - 32000 supported

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

That's a very good question - let's find that out.

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

Build pending here: http://jenkins.kodi.tv/job/Android-ARM/9720/
Let's use the opportunity to correctly support MONO and see if it works: fritsch@0f873e8

Here is a testfile: https://dl.dropboxusercontent.com/u/55728161/audio.mp3

Thanks for the feedback

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

The problem was with the way the samplerates were chosen. The iterator comparison was wrongly used. I changed the metric for matching samplerates. In order to resample more correctly if needed.

Let's wait until that aac 1.0 user from the forum has tested it. My samples are opened as stereo, so that needs to be found out.

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

For the record:

The bug is here: https://github.com/xbmc/xbmc/blob/master/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp#L248

If you query with 22050 hz the element the upper selects is 32000. That very moment the iterator points to begin() as 32000 is the first element in the set, therefore --s will not (!) point to begin() but to somewhere undefined. And this value we assign -> butz :-)

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

jenkins build and merge

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

jenkins build and merge after being interrupted by non jenkins merge.

@MartijnKaijser
Copy link
Member

Jenkins build this please

// prefer best match or alternatively something that divides nicely and
// is not too far away
uint32_t d = std::abs((int)m_format.m_sampleRate - (int)s) + 8 * (s > m_format.m_sampleRate ? (s % m_format.m_sampleRate) : (m_format.m_sampleRate % s));
if (d < distance)

This comment was marked as spam.

This comment was marked as spam.

@@ -34,6 +34,7 @@ int CJNIAudioFormat::ENCODING_DTS_HD = 0x00000008;
int CJNIAudioFormat::ENCODING_DOLBY_TRUEHD = 0x00000009;
int CJNIAudioFormat::ENCODING_IEC61937 = 0x0000000d;

int CJNIAudioFormat::CHANNEL_OUT_MONO = 0x00000004;
int CJNIAudioFormat::CHANNEL_OUT_STEREO = 0x0000000c;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -76,6 +77,7 @@ void CJNIAudioFormat::PopulateStaticFields()
if (sdk >= 5)
{
CJNIAudioFormat::CHANNEL_OUT_STEREO = get_static_field<int>(c, "CHANNEL_OUT_STEREO");
CJNIAudioFormat::CHANNEL_OUT_MONO = get_static_field<int>(c, "CHANNEL_OUT_MONO");

This comment was marked as spam.

This comment was marked as spam.

@fritsch
Copy link
Member Author

fritsch commented Oct 30, 2016

jenkins build this please

@fritsch fritsch merged commit bd57390 into xbmc:master Oct 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants