Permalink
Browse files

audio player was initialized as having audio out by default, even if …

…no audio output had beed created. This caused to always try to decode audio even when not required (like during commflagging)

Also, exit early in AVFD::ProcessAudioPacket if no one is listening.

Fixes #11616
  • Loading branch information...
jyavenard committed Jun 23, 2013
1 parent 2ed284b commit c9d8533fe8fc19fead0ad896f37bb8f07367cc57
@@ -11,7 +11,7 @@ AudioPlayer::AudioPlayer(MythPlayer *parent, bool muted)
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),
m_no_audio_in(false), m_no_audio_out(false), m_controls_volume(true)
m_no_audio_in(false), m_no_audio_out(true), m_controls_volume(true)
{
m_controls_volume = gCoreContext->GetNumSetting("MythControlsVolume", 1);
}
@@ -4387,7 +4387,8 @@ bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt,
audSubIdx = selectedTrack[kTrackTypeAudio].av_substream_index;
}
if (!(decodetype & kDecodeAudio) || (pkt->stream_index != audIdx))
if (!(decodetype & kDecodeAudio) || (pkt->stream_index != audIdx)
|| !m_audio->HasAudioOut())
break;
if (firstloop && pkt->pts != (int64_t)AV_NOPTS_VALUE)
@@ -427,7 +427,7 @@ bool PlayerContext::CreatePlayer(TV *tv, QWidget *widget,
if (pipState == kPIPOff || pipState == kPBPLeft)
{
if (audio->HasAudioOut())
if (IsAudioNeeded())
{
QString errMsg = audio->ReinitAudio();
}

0 comments on commit c9d8533

Please sign in to comment.