CPulseAudioClient* pClient = static_cast<CPulseAudioClient*>(user_data);
assert(pClient->__mpListener);
- if (pClient->__mIsInit == false) {
- AUDIO_IO_LOGD("Occurred this listener when an out stream is on the way to create : Write dummy, length[%d]", length);
-
- char* dummy = new char[length];
- memset(dummy, 0, length);
- pa_stream_write(s, dummy, length, NULL, 0LL, PA_SEEK_RELATIVE);
- delete [] dummy;
-
- return;
- }
-
pClient->__mpListener->onStream(pClient, length);
}
}
int CPulseAudioClient::write(const void* data, size_t length) throw(CAudioError) {
- if (__mIsInit == false) {
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
- }
-
- checkRunningState();
-
if (data == NULL) {
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid");
}
}
void CPulseAudioClient::checkRunningState() throw(CAudioError) {
- if (__mIsInit == false) {
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
- }
-
if (__mpContext == NULL || PA_CONTEXT_IS_GOOD(pa_context_get_state(__mpContext)) == 0) {
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, "The context[%p] is not created or not good state", __mpContext);
}
}
bool CPulseAudioClient::isInThread() throw(CAudioError) {
- if (__mIsInit == false) {
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
- }
-
int ret = pa_threaded_mainloop_in_thread(__mpMainloop);
#ifdef _AUDIO_IO_DEBUG_TIMING_