Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix audio digital passthrough device override setting
Some tests on the capabilities of the device were always performed on the main audio device. If a distinct digital device was defined, it could have been ignored.

Fixes #10621
  • Loading branch information
jyavenard committed Apr 18, 2012
1 parent c2fccb5 commit 9839dd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputalsa.cpp
Expand Up @@ -458,7 +458,7 @@ AudioOutputSettings* AudioOutputALSA::GetOutputSettings(bool passthrough)
QMap<QString, QString> *alsadevs = GetDevices("pcm");
while(1)
{
QString real_device = (((passthru || enc) && m_discretedigital) ?
QString real_device = ((passthrough && m_discretedigital) ?
passthru_device : main_device);

QString desc = alsadevs->value(real_device);
Expand Down
15 changes: 9 additions & 6 deletions mythtv/libs/libmyth/audio/audiooutputbase.cpp
Expand Up @@ -170,7 +170,8 @@ void AudioOutputBase::InitSettings(const AudioSettings &settings)
output_settings = GetOutputSettingsUsers(false);
output_settingsdigital = GetOutputSettingsUsers(true);

max_channels = output_settings->BestSupportedChannels();
max_channels = max(output_settings->BestSupportedChannels(),
output_settingsdigital->BestSupportedChannels());
configured_channels = max_channels;

upmix_default = max_channels > 2 ?
Expand Down Expand Up @@ -661,7 +662,7 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
.arg(output_settingsdigital->FeaturesToString())
.arg(configured_channels)
.arg(channels)
.arg(output_settings->IsSupportedChannels(channels))
.arg(OutputSettings(enc || passthru)->IsSupportedChannels(channels))
.arg(max_channels));

int dest_rate = 0;
Expand All @@ -670,16 +671,18 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
// or if 48k override was checked in settings
if ((samplerate != 48000 &&
gCoreContext->GetNumSetting("Audio48kOverride", false)) ||
(enc && (samplerate > 48000 || (need_resampler && dest_rate > 48000))))
(enc && (samplerate > 48000)))
{
VBAUDIO("Forcing resample to 48 kHz");
if (src_quality < 0)
src_quality = QUALITY_MEDIUM;
need_resampler = true;
dest_rate = 48000;
}
else if (
(need_resampler = !OutputSettings(enc)->IsSupportedRate(samplerate)))
// this will always be false for passthrough audio as
// CanPassthrough() already tested these conditions
else if ((need_resampler =
!OutputSettings(enc || passthru)->IsSupportedRate(samplerate)))
{
dest_rate = OutputSettings(enc)->NearestSupportedRate(samplerate);
}
Expand Down Expand Up @@ -762,7 +765,7 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
if (need_resampler || needs_upmix || needs_downmix ||
stretchfactor != 1.0f || (internal_vol && SWVolume()) ||
(enc && output_format != FORMAT_S16) ||
!OutputSettings(enc)->IsSupportedFormat(output_format))
!OutputSettings(enc || passthru)->IsSupportedFormat(output_format))
{
VBAUDIO("Audio processing enabled");
processing = true;
Expand Down
5 changes: 4 additions & 1 deletion mythtv/programs/mythfrontend/audiogeneralsettings.cpp
Expand Up @@ -354,7 +354,8 @@ AudioOutputSettings AudioConfigSettings::UpdateCapabilities(
m_MaxAudioChannels->resetMaxCount(3);
for (int i = 1; i <= max_speakers; i++)
{
if (invalid || settings.IsSupportedChannels(i))
if (invalid || settings.IsSupportedChannels(i) ||
settingsdigital.IsSupportedChannels(i))
{
QString txt;

Expand Down Expand Up @@ -415,6 +416,8 @@ void AudioConfigSettings::AudioAdvanced()

if (audiosettings.exec() == kDialogCodeAccepted)
{
// Rescan audio list to check of override digital device
AudioRescan();
bool LPCM2 = settings.canFeature(FEATURE_LPCM) &&
gCoreContext->GetNumSetting("StereoPCM", false);
// restore speakers configure only of StereoPCM has changed and
Expand Down

0 comments on commit 9839dd7

Please sign in to comment.