summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--audio.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 91d05b3..e2d10d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
User johns
+Date:
+
+ Fix bug: AudioEnqueue crash without sound card.
+
+User johns
Date: Sun Mar 4 22:35:36 CET 2012
Release Version 0.4.9
diff --git a/audio.c b/audio.c
index d2e8323..177f1a2 100644
--- a/audio.c
+++ b/audio.c
@@ -701,7 +701,7 @@ static void AlsaThread(void)
*/
static void AlsaThreadEnqueue(const void *samples, int count)
{
- if (!AlsaRingBuffer || !AlsaPCMHandle || !AudioSampleRate) {
+ if (!AlsaRingBuffer || !AlsaPCMHandle) {
Debug(3, "audio/alsa: enqueue not ready\n");
return;
}
@@ -1552,7 +1552,7 @@ static void OssThread(void)
*/
static void OssThreadEnqueue(const void *samples, int count)
{
- if (!OssRingBuffer || OssPcmFildes == -1 || !AudioSampleRate) {
+ if (!OssRingBuffer || OssPcmFildes == -1) {
Debug(3, "audio/oss: enqueue not ready\n");
return;
}
@@ -2080,7 +2080,9 @@ static void *AudioPlayHandlerThread(void *dummy)
} while (!AudioRunning);
Debug(3, "audio: ----> %d ms\n", (AudioUsedBytes() * 1000)
- / (AudioSampleRate * AudioChannels * AudioBytesProSample));
+ / (!AudioSampleRate
+ || !AudioChannels +
+ AudioSampleRate * AudioChannels * AudioBytesProSample));
pthread_mutex_unlock(&AudioMutex);
@@ -2182,6 +2184,9 @@ static const AudioModule *AudioModules[] = {
*/
void AudioEnqueue(const void *samples, int count)
{
+ if (!AudioSampleRate || !AudioChannels) {
+ return; // not setup
+ }
if (0) {
static uint32_t last;
static uint32_t tick;