Skip to content

Commit

Permalink
Do not display initial error reports about invalid parameters as this…
Browse files Browse the repository at this point in the history
… is obviously very confusing and reported in most reports

git-svn-id: http://svn.mythtv.org/svn/trunk@27273 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information
jyavenard committed Nov 18, 2010
1 parent bde9ee3 commit 116d87c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 20 deletions.
6 changes: 6 additions & 0 deletions mythtv/libs/libmyth/audiooutput.cpp
Expand Up @@ -192,6 +192,12 @@ void AudioOutput::Error(const QString &msg)
VERBOSE(VB_IMPORTANT, "AudioOutput Error: " + lastError);
}

void AudioOutput::SilentError(const QString &msg)
{
lastError = msg;
lastError.detach();
}

void AudioOutput::Warn(const QString &msg)
{
lastWarn = msg;
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmyth/audiooutput.h
Expand Up @@ -105,6 +105,7 @@ class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners

protected:
void Error(const QString &msg);
void SilentError(const QString &msg);
void Warn(const QString &msg);
void ClearError(void);
void ClearWarning(void);
Expand Down
16 changes: 8 additions & 8 deletions mythtv/libs/libmyth/audiooutputbase.cpp
Expand Up @@ -396,21 +396,21 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
was_paused = true;
internal_vol = gCoreContext->GetNumSetting("MythControlsVolume", 0);

VBAUDIO(QString("Original codec was %1, %2, %3 kHz, %4 channels")
.arg(ff_codec_id_string((CodecID)codec))
.arg(output_settings->FormatToString(format))
.arg(samplerate/1000).arg(source_channels));

// Don't try to do anything if audio hasn't been
// initialized yet (e.g. rubbish was provided)
if (source_channels <= 0 || format <= 0 || samplerate <= 0)
{
Error(QString("Aborting Audio Reconfigure. ") +
QString("Invalid audio parameters ch %1 fmt %2 @ %3Hz")
.arg(source_channels).arg(format).arg(samplerate));
SilentError(QString("Aborting Audio Reconfigure. ") +
QString("Invalid audio parameters ch %1 fmt %2 @ %3Hz")
.arg(source_channels).arg(format).arg(samplerate));
return;
}

VBAUDIO(QString("Original codec was %1, %2, %3 kHz, %4 channels")
.arg(ff_codec_id_string((CodecID)codec))
.arg(output_settings->FormatToString(format))
.arg(samplerate/1000).arg(source_channels));

/* Encode to AC-3 if we're allowed to passthru but aren't currently
and we have more than 2 channels but multichannel PCM is not supported
or if the device just doesn't support the number of channels */
Expand Down
29 changes: 19 additions & 10 deletions mythtv/libs/libmythtv/audioplayer.cpp
Expand Up @@ -5,8 +5,8 @@
#define LOC QString("AudioPlayer: ")

AudioPlayer::AudioPlayer(MythPlayer *parent, bool muted)
: m_parent(parent), m_audioOutput(NULL), m_channels(2),
m_orig_channels(2), m_codec(0), m_format(FORMAT_NONE),
: m_parent(parent), m_audioOutput(NULL), m_channels(-1),
m_orig_channels(-1), m_codec(0), m_format(FORMAT_NONE),
m_samplerate(44100), m_stretchfactor(1.0f), m_passthru(false),
m_lock(QMutex::Recursive), m_muted_on_creation(muted),
m_main_device(QString::null), m_passthru_device(QString::null),
Expand Down Expand Up @@ -44,18 +44,24 @@ QString AudioPlayer::ReinitAudio(void)
QMutexLocker lock(&m_lock);
QString errMsg = QString::null;

bool firstinit = (m_format == FORMAT_NONE &&
m_channels < 0 &&
m_samplerate == 44100);

if ((m_format == FORMAT_NONE) ||
(m_channels <= 0) ||
(m_samplerate <= 0))
{
VERBOSE(VB_IMPORTANT, LOC +
QString("Disabling Audio, params(%1,%2,%3)")
.arg(m_format).arg(m_channels).arg(m_samplerate));

if (!firstinit)
{
VERBOSE(VB_IMPORTANT, LOC +
QString("Disabling Audio, params(%1,%2,%3)")
.arg(m_format).arg(m_channels).arg(m_samplerate));
}
no_audio_in = no_audio_out = true;
}

no_audio_in = false;
else
no_audio_in = false;

if (no_audio_out && want_audio)
{
Expand All @@ -76,8 +82,11 @@ QString AudioPlayer::ReinitAudio(void)

if (!errMsg.isEmpty())
{
VERBOSE(VB_IMPORTANT, LOC + "Disabling Audio" +
QString(", reason is: %1").arg(errMsg));
if (!firstinit)
{
VERBOSE(VB_IMPORTANT, LOC + "Disabling Audio" +
QString(", reason is: %1").arg(errMsg));
}
no_audio_out = true;
}
else if (no_audio_out)
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythtv/playercontext.cpp
Expand Up @@ -468,8 +468,6 @@ bool PlayerContext::CreatePlayer(TV *tv, QWidget *widget,
if (audio->HasAudioOut())
{
QString errMsg = audio->ReinitAudio();
if (!errMsg.isEmpty())
VERBOSE(VB_IMPORTANT, LOC_ERR + errMsg);
}
}
else if (pipState == kPBPRight)
Expand Down

0 comments on commit 116d87c

Please sign in to comment.