Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed, include AE_FMT_S16NE as avaliable format on audiotrack sink

  • Loading branch information...
commit e56539477257718839e9644968ed78801248b573 1 parent 37b8fb7
@davilla davilla authored
View
19 xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
@@ -73,7 +73,7 @@ CAESinkAUDIOTRACK::CAESinkAUDIOTRACK()
: CThread("AudioTrack")
{
m_sinkbuffer = NULL;
- m_alignedS16LE = NULL;
+ m_alignedS16 = NULL;
m_volume_changed = false;
m_min_frames = 0;
m_sink_frameSize = 0;
@@ -166,8 +166,8 @@ void CAESinkAUDIOTRACK::Deinitialize()
m_wake.Set();
StopThread();
delete m_sinkbuffer, m_sinkbuffer = NULL;
- if (m_alignedS16LE)
- _aligned_free(m_alignedS16LE), m_alignedS16LE = NULL;
+ if (m_alignedS16)
+ _aligned_free(m_alignedS16), m_alignedS16 = NULL;
}
bool CAESinkAUDIOTRACK::IsCompatible(const AEAudioFormat format, const std::string &device)
@@ -216,7 +216,7 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, b
{
// write as many frames of audio as we can fit into our internal buffer.
- // our internal sink buffer is always AE_FMT_S16LE
+ // our internal sink buffer is always AE_FMT_S16
unsigned int write_frames = m_sinkbuffer->GetWriteSize() / m_sink_frameSize;
if (write_frames > frames)
write_frames = frames;
@@ -225,17 +225,19 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, b
{
switch(m_format.m_dataFormat)
{
+ // 99.95 percent of Android is LE so treat NE the same.
@garbear Collaborator
garbear added a note

Shouldn't the __BIG_ENDIAN__ macro be able to resolve NE on android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
case AE_FMT_S16LE:
+ case AE_FMT_S16NE:
m_sinkbuffer->Write(data, write_frames * m_sink_frameSize);
m_wake.Set();
break;
#if defined(__ARM_NEON__)
case AE_FMT_FLOAT:
- if (!m_alignedS16LE)
- m_alignedS16LE = (int16_t*)_aligned_malloc(m_format.m_frames * m_sink_frameSize, 16);
+ if (!m_alignedS16)
+ m_alignedS16 = (int16_t*)_aligned_malloc(m_format.m_frames * m_sink_frameSize, 16);
// neon convert AE_FMT_S16LE to AE_FMT_FLOAT
- pa_sconv_s16le_from_f32ne_neon(write_frames * m_format.m_channelLayout.Count(), (const float32_t *)data, m_alignedS16LE);
- m_sinkbuffer->Write((unsigned char*)m_alignedS16LE, write_frames * m_sink_frameSize);
+ pa_sconv_s16le_from_f32ne_neon(write_frames * m_format.m_channelLayout.Count(), (const float32_t *)data, m_alignedS16);
+ m_sinkbuffer->Write((unsigned char*)m_alignedS16, write_frames * m_sink_frameSize);
m_wake.Set();
break;
#endif
@@ -282,6 +284,7 @@ void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
m_info.m_sampleRates.push_back(44100);
m_info.m_sampleRates.push_back(48000);
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
+ m_info.m_dataFormats.push_back(AE_FMT_S16NE);
#if defined(__ARM_NEON__)
if (g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON)
m_info.m_dataFormats.push_back(AE_FMT_FLOAT);
View
2  xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h
@@ -53,7 +53,7 @@ class CAESinkAUDIOTRACK : public CThread, public IAESink
double m_volume;
bool m_volume_changed;
volatile int m_min_frames;
- int16_t *m_alignedS16LE;
+ int16_t *m_alignedS16;
AERingBuffer *m_sinkbuffer;
unsigned int m_sink_frameSize;
double m_sinkbuffer_sec;

2 comments on commit e565394

@davilla
Collaborator

@FernetMenta, ActiveAE assumes AE_FMT_S16NE is present if AE_FMT_S16LE is an available format.

@FernetMenta
Collaborator

where does it assume AE_FMT_S16NE? ffmpeg only can handle those formats: https://github.com/FernetMenta/xbmc/blob/sledgehammer/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp#L185

If the format is not supported, it falls back to float and needs the convert function in ActiveAESink. Maybe CActiveAEResample::GetAVSampleFormat should be fixed to treat LE like NE on LE systems.

Please sign in to comment.
Something went wrong with that request. Please try again.