Skip to content
Browse files

[SoftAE] pass audio/silence down to the sink so it can decide if it w…

…ants to output
  • Loading branch information...
1 parent ff3a880 commit 74ba6a57b49221153150399dbed37b0031da4ec0 Cory Fields committed Jul 9, 2012
View
6 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
@@ -1009,7 +1009,7 @@ int CSoftAE::RunOutputStage(bool hasAudio)
data = m_converted;
}
- wroteFrames = m_sink->AddPackets((uint8_t*)data, m_sinkFormat.m_frames);
+ wroteFrames = m_sink->AddPackets((uint8_t*)data, m_sinkFormat.m_frames, hasAudio);
/* Return value of INT_MAX signals error in sink - restart */
if (wroteFrames == INT_MAX)
@@ -1047,7 +1047,7 @@ int CSoftAE::RunRawOutputStage(bool hasAudio)
data = m_converted;
}
- int wroteFrames = m_sink->AddPackets((uint8_t *)data, m_sinkFormat.m_frames);
+ int wroteFrames = m_sink->AddPackets((uint8_t *)data, m_sinkFormat.m_frames, hasAudio);
/* Return value of INT_MAX signals error in sink - restart */
if (wroteFrames == INT_MAX)
@@ -1108,7 +1108,7 @@ int CSoftAE::RunTranscodeStage(bool hasAudio)
/* if we have enough data to write */
if (m_encodedBuffer.Used() >= sinkBlock)
{
- int wroteFrames = m_sink->AddPackets((uint8_t*)m_encodedBuffer.Raw(sinkBlock), m_sinkFormat.m_frames);
+ int wroteFrames = m_sink->AddPackets((uint8_t*)m_encodedBuffer.Raw(sinkBlock), m_sinkFormat.m_frames, hasAudio);
/* Return value of INT_MAX signals error in sink - restart */
if (wroteFrames == INT_MAX)
View
2 xbmc/cores/AudioEngine/Interfaces/AESink.h
@@ -72,7 +72,7 @@ class IAESink
/*
Adds packets to be sent out, this routine MUST block or sleep.
*/
- virtual unsigned int AddPackets(uint8_t *data, unsigned int frames) = 0;
+ virtual unsigned int AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) = 0;
/*
Drain the sink
View
2 xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -474,7 +474,7 @@ double CAESinkALSA::GetCacheTotal()
return (double)m_bufferSize * m_formatSampleRateMul;
}
-unsigned int CAESinkALSA::AddPackets(uint8_t *data, unsigned int frames)
+unsigned int CAESinkALSA::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio)
{
if (!m_pcm)
return 0;
View
2 xbmc/cores/AudioEngine/Sinks/AESinkALSA.h
@@ -48,7 +48,7 @@ class CAESinkALSA : public IAESink
virtual double GetDelay ();
virtual double GetCacheTime ();
virtual double GetCacheTotal ();
- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames);
+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio);
virtual void Drain ();
static void EnumerateDevicesEx(AEDeviceInfoList &list);
View
2 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h
@@ -43,7 +43,7 @@ class CAESinkDirectSound : public IAESink
virtual double GetDelay ();
virtual double GetCacheTime ();
virtual double GetCacheTotal ();
- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames);
+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio);
static void EnumerateDevicesEx (AEDeviceInfoList &deviceInfoList);
private:
void AEChannelsFromSpeakerMask(DWORD speakers);
View
2 xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp
@@ -81,7 +81,7 @@ double CAESinkNULL::GetDelay()
return std::max(0.0, (double)(m_ts - CurrentHostCounter()) / 1000000.0f);
}
-unsigned int CAESinkNULL::AddPackets(uint8_t *data, unsigned int frames)
+unsigned int CAESinkNULL::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio)
{
float timeout = m_msPerFrame * frames;
m_ts = CurrentHostCounter() + MathUtils::round_int(timeout * 1000000.0f);
View
2 xbmc/cores/AudioEngine/Sinks/AESinkNULL.h
@@ -40,7 +40,7 @@ class CAESinkNULL : public IAESink
virtual double GetDelay ();
virtual double GetCacheTime () { return 0.0; }
virtual double GetCacheTotal () { return 0.0; }
- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames);
+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio);
virtual void Drain ();
static void EnumerateDevices(AEDeviceList &devices, bool passthrough);
private:
View
2 xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp
@@ -427,7 +427,7 @@ double CAESinkOSS::GetDelay()
return (double)delay / (m_format.m_frameSize * m_format.m_sampleRate);
}
-unsigned int CAESinkOSS::AddPackets(uint8_t *data, unsigned int frames)
+unsigned int CAESinkOSS::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio)
{
int size = frames * m_format.m_frameSize;
int wrote = write(m_fd, data, size);
View
2 xbmc/cores/AudioEngine/Sinks/AESinkOSS.h
@@ -42,7 +42,7 @@ class CAESinkOSS : public IAESink
virtual double GetDelay ();
virtual double GetCacheTime () { return 0.0; } /* FIXME */
virtual double GetCacheTotal () { return 0.0; } /* FIXME */
- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames);
+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio);
virtual void Drain ();
static void EnumerateDevicesEx(AEDeviceInfoList &list);
private:
View
2 xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp
@@ -73,7 +73,7 @@ double CAESinkProfiler::GetDelay()
return 0.0f;
}
-unsigned int CAESinkProfiler::AddPackets(uint8_t *data, unsigned int frames)
+unsigned int CAESinkProfiler::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio)
{
int64_t ts = CurrentHostCounter();
CLog::Log(LOGDEBUG, "CAESinkProfiler::AddPackets - latency %f ms", (float)(ts - m_ts) / 1000000.0f);
View
2 xbmc/cores/AudioEngine/Sinks/AESinkProfiler.h
@@ -40,7 +40,7 @@ class CAESinkProfiler : public IAESink
virtual double GetDelay ();
virtual double GetCacheTime () { return 0.0; }
virtual double GetCacheTotal () { return 0.0; }
- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames);
+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio);
virtual void Drain ();
static void EnumerateDevices(AEDeviceList &devices, bool passthrough);
private:
View
2 xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
@@ -362,7 +362,7 @@ double CAESinkWASAPI::GetCacheTotal()
return hnsLatency / 10.0;
}
-unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames)
+unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio)
{
if (!m_initialized)
return 0;
View
2 xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h
@@ -43,7 +43,7 @@ class CAESinkWASAPI : public IAESink
virtual double GetDelay ();
virtual double GetCacheTime ();
virtual double GetCacheTotal ();
- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames);
+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio);
static void EnumerateDevicesEx (AEDeviceInfoList &deviceInfoList);
private:
bool InitializeExclusive(AEAudioFormat &format);

0 comments on commit 74ba6a5

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