Skip to content

Commit

Permalink
ActiveAE: fix crash for multiple streams when transcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Aug 26, 2013
1 parent 3806410 commit 61acd19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
Expand Up @@ -801,7 +801,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)


AEAudioFormat sinkInputFormat, inputFormat; AEAudioFormat sinkInputFormat, inputFormat;
AEAudioFormat oldInternalFormat = m_internalFormat; AEAudioFormat oldInternalFormat = m_internalFormat;
m_mode = MODE_PCM; bool updateMode = true;


if (m_streams.empty()) if (m_streams.empty())
{ {
Expand All @@ -822,14 +822,15 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
else if (m_streams.size() > 1 && m_silenceBuffers == NULL) else if (m_streams.size() > 1 && m_silenceBuffers == NULL)
{ {
inputFormat = m_sinkRequestFormat; inputFormat = m_sinkRequestFormat;
updateMode = false;
} }
else else
{ {
inputFormat = m_streams.front()->m_format; inputFormat = m_streams.front()->m_format;
} }


m_sinkRequestFormat = inputFormat; m_sinkRequestFormat = inputFormat;
ApplySettingsToFormat(m_sinkRequestFormat, m_settings, true); ApplySettingsToFormat(m_sinkRequestFormat, m_settings, updateMode);
std::string device = AE_IS_RAW(m_sinkRequestFormat.m_dataFormat) ? m_settings.passthoughdevice : m_settings.device; std::string device = AE_IS_RAW(m_sinkRequestFormat.m_dataFormat) ? m_settings.passthoughdevice : m_settings.device;
std::string driver; std::string driver;
CAESinkFactory::ParseDevice(device, driver); CAESinkFactory::ParseDevice(device, driver);
Expand Down Expand Up @@ -1210,6 +1211,9 @@ void CActiveAE::ChangeResampleQuality()


void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &settings, bool setmode) void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &settings, bool setmode)
{ {
if (setmode)
m_mode = MODE_PCM;

// raw pass through // raw pass through
if (m_settings.mode != AUDIO_ANALOG && AE_IS_RAW(format.m_dataFormat)) if (m_settings.mode != AUDIO_ANALOG && AE_IS_RAW(format.m_dataFormat))
{ {
Expand Down

0 comments on commit 61acd19

Please sign in to comment.