m_format = format;
format.m_dataFormat = m_passthrough ? AE_FMT_S16NE : format.m_dataFormat;
- Pause(false);
+ // Cork stream will resume when adding first package
+ Pause(true);
{
CSingleLock lock(m_sec);
m_IsAllocated = true;
if (!m_IsAllocated)
return frames;
+ if (m_IsStreamPaused)
+ {
+ Pause(false);
+ }
+
pa_threaded_mainloop_lock(m_MainLoop);
unsigned int available = frames * m_format.m_frameSize;
return m_IsAllocated;
}
-bool CAESinkPULSE::Pause(bool pause)
+void CAESinkPULSE::Pause(bool pause)
{
pa_threaded_mainloop_lock(m_MainLoop);
if (!WaitForOperation(pa_stream_cork(m_Stream, pause ? 1 : 0, NULL, NULL), m_MainLoop, pause ? "Pause" : "Resume"))
pause = !pause;
+ m_IsStreamPaused = pause;
pa_threaded_mainloop_unlock(m_MainLoop);
-
- return pause;
}
inline bool CAESinkPULSE::WaitForOperation(pa_operation *op, pa_threaded_mainloop *mainloop, const char *LogEntry = "")
bool IsInitialized();
CCriticalSection m_sec;
private:
- bool Pause(bool pause);
+ void Pause(bool pause);
static inline bool WaitForOperation(pa_operation *op, pa_threaded_mainloop *mainloop, const char *LogEntry);
static bool SetupContext(const char *host, pa_context **context, pa_threaded_mainloop **mainloop);
bool m_IsAllocated;
bool m_passthrough;
+ bool m_IsStreamPaused;
AEAudioFormat m_format;
unsigned int m_BytesPerSecond;