Skip to content

Commit

Permalink
AESinkAudiotrack: Use 192 khz for TrueHD
Browse files Browse the repository at this point in the history
The 48 khz is historically chosen. There is no way, that this bandwidth would
be enough to do DTS-HD-MA or TrueHD. With this new check, we would not list
that format anymore - as in the past - it auto fellback to normal DTS and on
some machines failed for TrueHD directly.
Packers of FireTV only pack DTS-HD-Core, so we keep it on 48 khz here.

See also: https://forum.kodi.tv/showthread.php?tid=378616
  • Loading branch information
fritsch committed Sep 7, 2024
1 parent 275dce0 commit 45e538a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,19 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
m_encoding = AEStreamFormatToATFormat(m_format.m_streamInfo.m_type);
m_format.m_channelLayout = AE_CH_LAYOUT_2_0;

if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_DTSHD_MA ||
m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD)
if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_DTSHD_MA)
{
// we keep the 48 khz sample rate, reason: Androids packer only packs DTS Core
// even if we ask for DTS-HD-MA it seems.
m_format.m_channelLayout = AE_CH_LAYOUT_7_1;
}

if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD)
{
m_format.m_channelLayout = AE_CH_LAYOUT_7_1;
m_sink_sampleRate = 192000;
}

// EAC3 needs real samplerate not the modulation
if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_EAC3)
m_sink_sampleRate = m_format.m_streamInfo.m_sampleRate;
Expand Down Expand Up @@ -1073,6 +1080,8 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
m_info.m_wantsIECPassthrough = false;
m_info.m_dataFormats.push_back(AE_FMT_RAW);
m_info.m_streamTypes.clear();
bool supports_192khz = m_sink_sampleRates.find(192000) != m_sink_sampleRates.end();

if (isRaw)
{
bool canDoAC3 = false;
Expand Down Expand Up @@ -1126,9 +1135,9 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD_MA);
}
}
if (CJNIAudioFormat::ENCODING_DOLBY_TRUEHD != -1)
if (CJNIAudioFormat::ENCODING_DOLBY_TRUEHD != -1 && supports_192khz)
{
if (VerifySinkConfiguration(48000, AEChannelMapToAUDIOTRACKChannelMask(AE_CH_LAYOUT_7_1),
if (VerifySinkConfiguration(192000, AEChannelMapToAUDIOTRACKChannelMask(AE_CH_LAYOUT_7_1),
CJNIAudioFormat::ENCODING_DOLBY_TRUEHD, true))
{
CLog::Log(LOGDEBUG, "Firmware implements TrueHD RAW");
Expand All @@ -1146,7 +1155,6 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
CJNIAudioFormat::ENCODING_IEC61937);
if (supports_iec)
{
bool supports_192khz = m_sink_sampleRates.find(192000) != m_sink_sampleRates.end();
m_info.m_wantsIECPassthrough = true;
m_info.m_streamTypes.clear();
m_info.m_dataFormats.push_back(AE_FMT_RAW);
Expand Down

0 comments on commit 45e538a

Please sign in to comment.