summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-01-13 19:33:59 +0100
committerJohns <johns98@gmx.net>2012-01-13 19:33:59 +0100
commitbaf577aba59a85cfe41849606256a279523fa50c (patch)
treec613cfb4815cdaa5705ab46f3463ab4410020785
parent81d7ef97556df59aede50d48dfcd61c38e13df61 (diff)
downloadvdr-plugin-softhddevice-baf577aba59a85cfe41849606256a279523fa50c.tar.gz
vdr-plugin-softhddevice-baf577aba59a85cfe41849606256a279523fa50c.tar.bz2
Fix bug: snd_pcm_state: Assertion `pcm' failed.
-rw-r--r--Todo2
-rw-r--r--audio.c38
2 files changed, 13 insertions, 27 deletions
diff --git a/Todo b/Todo
index c73e7f8..519c0c3 100644
--- a/Todo
+++ b/Todo
@@ -60,7 +60,7 @@ audio/alsa:
done? video/audio asyncron
random crashes in av_parser_parse2, when switching channels
sometimes alsa hangs
- snd_pcm_state: Assertion `pcm' failed. while switching channels
+ fixed? snd_pcm_state: Assertion `pcm' failed. while switching channels
(thread problem)
better downmix of >2 channels on 2 channel hardware
diff --git a/audio.c b/audio.c
index 5a83f48..c7f04b1 100644
--- a/audio.c
+++ b/audio.c
@@ -856,23 +856,9 @@ static int AlsaSetup(int *freq, int *channels)
if (!AlsaPCMHandle) { // alsa not running yet
return -1;
}
-#if 1
+#if 1 // easy alsa hw setup way
// flush any buffered data
-#ifndef SEARCH_HDMI_BUG2
-#ifdef USE_AUDIO_THREAD
- if (AudioRunning) {
- while (AudioRunning) {
- AlsaFlushBuffer = 1;
- usleep(1 * 1000);
- }
- AlsaFlushBuffer = 0;
- } else
-#endif
- {
- AlsaFlushBuffers();
- }
-#endif
- AudioPTS = INT64_C(0x8000000000000000);
+ AudioFlushBuffers();
if (1) { // close+open to fix hdmi no sound bugs
handle = AlsaPCMHandle;
@@ -1449,7 +1435,6 @@ static int OssSetup(int *freq, int *channels)
AudioRunning = 0;
OssFlushBuffers();
}
- AudioPTS = INT64_C(0x8000000000000000);
ret = 0;
@@ -1711,17 +1696,18 @@ void AudioFlushBuffers(void)
{
#ifdef USE_ALSA
#ifdef USE_AUDIO_THREAD
- if (AudioRunning) {
- while (AudioRunning) {
- AlsaFlushBuffer = 1;
+ // signal thread to flush buffers
+ if (AudioThread) {
+ AlsaFlushBuffer = 1;
+ do {
+ AudioRunning = 1; // wakeup in case of sleeping
+ pthread_cond_signal(&AudioStartCond);
usleep(1 * 1000);
- }
- AlsaFlushBuffer = 0;
- } else
-#endif
- {
- AlsaFlushBuffers();
+ } while (AlsaFlushBuffer); // wait until flushed
}
+#else
+ AlsaFlushBuffers();
+#endif
#endif
#ifdef USE_OSS
OssFlushBuffers();