diff options
author | Johns <johns98@gmx.net> | 2012-03-05 15:06:46 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-03-05 15:06:46 +0100 |
commit | 3812fa8d38d0fea3ec2f629c90e5fe943c70a926 (patch) | |
tree | 2ff3f7bf6685dea7f22c342d0e4cb560c1a691dc /audio.c | |
parent | da5c5cd5fd9619f5b451cdcdc3aa279b59b8c362 (diff) | |
download | vdr-plugin-softhddevice-3812fa8d38d0fea3ec2f629c90e5fe943c70a926.tar.gz vdr-plugin-softhddevice-3812fa8d38d0fea3ec2f629c90e5fe943c70a926.tar.bz2 |
Fix bug: AudioEnqueue crash without sound card.
Diffstat (limited to 'audio.c')
-rw-r--r-- | audio.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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; |