From 9dd248f9d0ad9df9cc3413b2ba92dcbc03aa8fd3 Mon Sep 17 00:00:00 2001 From: Johns Date: Thu, 11 Apr 2013 12:03:38 +0200 Subject: [PATCH] Enable seamless audio track change. --- ChangeLog | 1 + audio.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 747f46c..d57bd67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ User johns Date: + Enable seamless audio track change. Fix bug #1302: Unsupported pixel format crash. Fix the fix, when sillpicture is called in suspend mode. Fix crash, when sillpicture is called in suspend mode. diff --git a/audio.c b/audio.c index ae64361..fa518d5 100644 --- a/audio.c +++ b/audio.c @@ -678,8 +678,7 @@ static int AudioRingAdd(unsigned sample_rate, int channels, int passthrough) } AudioRingWrite = (AudioRingWrite + 1) % AUDIO_RING_MAX; - // FIXME: don't flush buffers here - AudioRing[AudioRingWrite].FlushBuffers = 1; + AudioRing[AudioRingWrite].FlushBuffers = 0; AudioRing[AudioRingWrite].Passthrough = passthrough; AudioRing[AudioRingWrite].PacketSize = 0; AudioRing[AudioRingWrite].InSampleRate = sample_rate; @@ -689,6 +688,9 @@ static int AudioRingAdd(unsigned sample_rate, int channels, int passthrough) AudioRing[AudioRingWrite].PTS = INT64_C(0x8000000000000000); RingBufferReset(AudioRing[AudioRingWrite].RingBuffer); + Debug(3, "audio: %d ring buffer prepared\n", + atomic_read(&AudioRingFilled) + 1); + atomic_inc(&AudioRingFilled); #ifdef USE_AUDIO_THREAD @@ -2417,6 +2419,7 @@ void AudioFlushBuffers(void) int i; old = AudioRingWrite; + // FIXME: check ring buffer overflow AudioRingWrite = (AudioRingWrite + 1) % AUDIO_RING_MAX; AudioRing[AudioRingWrite].FlushBuffers = 1; AudioRing[AudioRingWrite].Passthrough = AudioRing[old].Passthrough;