Author: agrundman
Date: Fri Feb 19 09:22:19 2010
New Revision: 8532

URL: http://svn.slimdevices.com/jive?rev=8532&view=rev
Log:
Fixed Bug 15344, patch from Alan to reset sync_elapsed_samples correctly when 
changing tracks

Modified:
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
    7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/audio_helper.c
    7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua?rev=8532&r1=8531&r2=8532&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua 
(original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua Fri Feb 
19 09:22:19 2010
@@ -328,7 +328,7 @@
                and status.audioState & DECODE_STOPPING == 0
                and (self.tracksStarted < status.tracksStarted) then
 
-               log:debug("status TRACK STARTED")
+               log:debug("status TRACK STARTED (elapsed: ", status.elapsed, 
")")
                self:sendStatus(status, "STMs")
 
                self.tracksStarted = status.tracksStarted

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/audio_helper.c
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/audio_helper.c?rev=8532&r1=8531&r2=8532&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/audio_helper.c 
(original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/audio_helper.c Fri 
Feb 19 09:22:19 2010
@@ -65,6 +65,7 @@
        decode_audio->check_start_point = FALSE;
        decode_audio->num_tracks_started++;
        decode_audio->elapsed_samples = BYTES_TO_SAMPLES(track_start_offset);
+       decode_audio->sync_elapsed_timestamp = 0; /* bug 15344: don't send 
previous-track data */
 
        return true;
 }

Modified: 
7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c?rev=8532&r1=8531&r2=8532&view=diff
==============================================================================
--- 
7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c 
(original)
+++ 
7.5/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c 
Fri Feb 19 09:22:19 2010
@@ -845,8 +845,8 @@
                                        /* sync accurate playpoint */
                                        if (size == ( snd_pcm_uframes_t) 
state->period_size) {
                                                /* only first time around loop, 
before calling playback_callback(),
-                                                * because the this should be 
just after the ALSA DMA interrupt has fired
-                                                * which with have actualised 
the delay validity */
+                                                * because then this should be 
just after the ALSA DMA interrupt has fired
+                                                * which will have actualised 
the delay validity */
 
                                                
decode_audio->sync_elapsed_samples = decode_audio->elapsed_samples;
                                                delay = 
snd_pcm_status_get_delay(status);
@@ -854,6 +854,17 @@
                                                if 
(decode_audio->sync_elapsed_samples > delay) {
                                                        
decode_audio->sync_elapsed_samples -= delay;
                                                }
+                                               
+                                               /* have not reached start of 
track yet */
+                                               else {
+                                                       /* This value - '0' - 
will usually be an over-estimate;
+                                                        * The STMs 
(track-start) can then be sent prematurely by up to 20ms
+                                                        * (or more if 
non-default ALSA parameters are being used)
+                                                        * but this is rather 
unlikely in practice.
+                                                        */
+                                                       
decode_audio->sync_elapsed_samples = 0;
+                                               }
+                                       
                                                
decode_audio->sync_elapsed_timestamp = jive_jiffies();
                                        }
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to