Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #3201 from FernetMenta/aefixes

ActiveAE: fixes
  • Loading branch information...
commit 17596005e61eac32db5b101824f3a2f9dd1a4f8b 2 parents 9d75119 + 2b6a889
@FernetMenta FernetMenta authored
View
31 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
@@ -396,7 +396,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::SILENCEMODE, &silence, sizeof(bool));
}
LoadSettings();
- ChangeResampleQuality();
+ ChangeResamplers();
if (!NeedReconfigureBuffers() && !NeedReconfigureSink())
return;
m_state = AE_TOP_RECONFIGURING;
@@ -423,8 +423,9 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
CActiveAEStream *stream;
stream = *(CActiveAEStream**)msg->data;
stream->m_paused = true;
- if (m_streams.size() == 1)
+ if (stream->m_paused != true && m_streams.size() == 1)
FlushEngine();
+ stream->m_paused = true;
return;
case CActiveAEControlProtocol::RESUMESTREAM:
stream = *(CActiveAEStream**)msg->data;
@@ -898,12 +899,6 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
outputFormat.m_dataFormat = AE_FMT_FLOATP;
outputFormat.m_sampleRate = 48000;
- if (g_advancedSettings.m_audioResample)
- {
- outputFormat.m_sampleRate = g_advancedSettings.m_audioResample;
- CLog::Log(LOGINFO, "CActiveAE::Configure - Forcing samplerate to %d", inputFormat.m_sampleRate);
- }
-
// setup encoder
if (!m_encoder)
{
@@ -982,7 +977,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
if (!(*it)->m_resampleBuffers)
{
(*it)->m_resampleBuffers = new CActiveAEBufferPoolResample((*it)->m_inputBuffers->m_format, outputFormat, m_settings.resampleQuality);
- (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false);
+ (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false, m_settings.stereoupmix);
}
if (m_mode == MODE_TRANSCODE || m_streams.size() > 1)
(*it)->m_resampleBuffers->m_fillPackets = true;
@@ -1006,7 +1001,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
vizFormat.m_dataFormat = AE_FMT_FLOAT;
m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat, m_settings.resampleQuality);
// TODO use cache of sync + water level
- m_vizBuffers->Create(2000, false);
+ m_vizBuffers->Create(2000, false, false);
m_vizInitialized = false;
}
}
@@ -1022,7 +1017,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
if (!m_sinkBuffers)
{
m_sinkBuffers = new CActiveAEBufferPoolResample(sinkInputFormat, m_sinkFormat, m_settings.resampleQuality);
- m_sinkBuffers->Create(MAX_WATER_LEVEL*1000, true);
+ m_sinkBuffers->Create(MAX_WATER_LEVEL*1000, true, false);
}
// reset gui sounds
@@ -1191,14 +1186,19 @@ void CActiveAE::DiscardSound(CActiveAESound *sound)
}
}
-void CActiveAE::ChangeResampleQuality()
+void CActiveAE::ChangeResamplers()
{
std::list<CActiveAEStream*>::iterator it;
for(it=m_streams.begin(); it!=m_streams.end(); ++it)
{
- if ((*it)->m_resampleBuffers && (*it)->m_resampleBuffers->m_resampler && ((*it)->m_resampleBuffers->m_resampleQuality != m_settings.resampleQuality))
+ if ((*it)->m_resampleBuffers && (*it)->m_resampleBuffers->m_resampler &&
+ (((*it)->m_resampleBuffers->m_resampleQuality != m_settings.resampleQuality) ||
+ ((*it)->m_resampleBuffers->m_stereoUpmix != m_settings.stereoupmix)))
+ {
(*it)->m_resampleBuffers->m_changeResampler = true;
+ }
(*it)->m_resampleBuffers->m_resampleQuality = m_settings.resampleQuality;
+ (*it)->m_resampleBuffers->m_stereoUpmix = m_settings.stereoupmix;
}
}
@@ -1237,7 +1237,9 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett
else
{
format.m_dataFormat = AE_FMT_FLOAT;
- if ((format.m_channelLayout.Count() > 2) || settings.stereoupmix)
+ if ((format.m_channelLayout.Count() > 2) ||
+ settings.stereoupmix ||
+ !g_advancedSettings.m_audioAudiophile)
{
switch (settings.channels)
{
@@ -2302,6 +2304,7 @@ bool CActiveAE::ResampleSound(CActiveAESound *sound)
orig_config.sample_rate,
orig_config.fmt,
orig_config.bits_per_sample,
+ false,
NULL,
AE_QUALITY_MID);
View
2  xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h
@@ -261,7 +261,7 @@ class CActiveAE : public IAE, private CThread
void ClearDiscardedBuffers();
void SStopSound(CActiveAESound *sound);
void DiscardSound(CActiveAESound *sound);
- void ChangeResampleQuality();
+ void ChangeResamplers();
bool RunStages();
bool HasWork();
View
7 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
@@ -145,6 +145,7 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm
m_resampleRatio = 1.0;
m_resampleQuality = quality;
m_changeResampler = false;
+ m_stereoUpmix = false;
}
CActiveAEBufferPoolResample::~CActiveAEBufferPoolResample()
@@ -152,7 +153,7 @@ CActiveAEBufferPoolResample::~CActiveAEBufferPoolResample()
delete m_resampler;
}
-bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap)
+bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap, bool upmix)
{
CActiveAEBufferPool::Create(totaltime);
@@ -171,6 +172,7 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap)
m_inputFormat.m_sampleRate,
CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat),
CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat),
+ upmix,
remap ? &m_format.m_channelLayout : NULL,
m_resampleQuality);
}
@@ -178,6 +180,8 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap)
// store output sampling rate, needed when ratio gets changed
m_outSampleRate = m_format.m_sampleRate;
+ m_stereoUpmix = upmix;
+
return true;
}
@@ -198,6 +202,7 @@ void CActiveAEBufferPoolResample::ChangeResampler()
m_inputFormat.m_sampleRate,
CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat),
CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat),
+ m_stereoUpmix,
NULL,
m_resampleQuality);
View
3  xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
@@ -90,7 +90,7 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool
public:
CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality);
virtual ~CActiveAEBufferPoolResample();
- virtual bool Create(unsigned int totaltime, bool remap);
+ virtual bool Create(unsigned int totaltime, bool remap, bool upmix);
void ChangeResampler();
bool ResampleBuffers(unsigned int timestamp = 0);
float GetDelay();
@@ -108,6 +108,7 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool
double m_resampleRatio;
AEQuality m_resampleQuality;
unsigned int m_outSampleRate;
+ bool m_stereoUpmix;
};
}
View
4 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp
@@ -36,7 +36,7 @@ CActiveAEResample::~CActiveAEResample()
m_dllSwResample.Unload();
}
-bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, CAEChannelInfo *remapLayout, AEQuality quality)
+bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, CAEChannelInfo *remapLayout, AEQuality quality)
{
if (!m_dllAvUtil.Load() || !m_dllSwResample.Load())
return false;
@@ -109,7 +109,7 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst
}
}
// stereo upmix
- else if (m_src_channels == 2 && m_dst_channels > 2)
+ else if (upmix && m_src_channels == 2 && m_dst_channels > 2)
{
memset(m_rematrix, 0, sizeof(m_rematrix));
for (int out=0; out<m_dst_channels; out++)
View
2  xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h
@@ -34,7 +34,7 @@ class CActiveAEResample
public:
CActiveAEResample();
virtual ~CActiveAEResample();
- bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, CAEChannelInfo *remapLayout, AEQuality quality);
+ bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, CAEChannelInfo *remapLayout, AEQuality quality);
int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples);
int64_t GetDelay(int64_t base);
int GetBufferedSamples();
Please sign in to comment.
Something went wrong with that request. Please try again.