Author: ayoung
Date: Thu Feb  3 01:49:09 2011
New Revision: 9300

URL: http://svn.slimdevices.com/jive?rev=9300&view=rev
Log:
Fixed bug 16191: ALAC Songs being cutoff before they end. 
When using the ALAC CODEC in SqueezePlay players (which is not the default with 
7.5 unless using SB Touch's inbuilt server - other instances of SbS transcode 
ALAC to FLAC), the decoder callback can be called when the stream buffer 
contains insufficient data to decode a full frame. The decode thread only 
ensures that there are 512 bytes available before calling the callback, except 
in the case of FLAC. We could use a similar hack for ALAC as is used for FLAC 
but it is simpler and more robust to allow the callback to handle the 
insufficient-data case gracefully. This applies to both ALAC and AAC.

Modified:
    7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alac.c
    7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alac.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alac.c?rev=9300&r1=9299&r2=9300&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alac.c 
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alac.c Thu 
Feb  3 01:49:09 2011
@@ -59,12 +59,14 @@
                if (status == 2) {
                        return TRUE;            /* need to wait for some more 
data */
                } else  if (status != 1) {
+                       LOG_DEBUG(log_audio_codec, "mp4_open() failed");
                        current_decoder_state |= DECODE_STATE_ERROR | 
DECODE_STATE_NOT_SUPPORTED;
                        return FALSE;
                }
 
                mp4_track_conf(&self->mp4, 0, &conf, &conf_size);
                if (!conf) {
+                       LOG_DEBUG(log_audio_codec, "mp4_track_conf() failed");
                        current_decoder_state |= DECODE_STATE_ERROR | 
DECODE_STATE_NOT_SUPPORTED;
                        return FALSE;
                }
@@ -83,8 +85,12 @@
        avpkt.data = (void *)mp4_read(&self->mp4, 0, &len, &streaming);
        avpkt.size = len;
        if (avpkt.size == 0) {
-               current_decoder_state |= DECODE_STATE_UNDERRUN;
-               return FALSE;
+               if (streaming) {
+                       return TRUE;    /* need to wait for more */
+               } else {
+                       current_decoder_state |= DECODE_STATE_UNDERRUN;
+                       return FALSE;
+               }
        }
 
        outputsize = OUTPUT_BUFFER_SIZE / 2;

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c?rev=9300&r1=9299&r2=9300&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c Thu Feb  3 01:49:09 
2011
@@ -777,6 +777,8 @@
                if (pos == 0) {
                        /* end of file */
                        *rlen = 0;
+                       if (streaming) *streaming = 0;  /* if we have reached 
the logical end of the stream,
+                                                                               
                then indicate no longer streaming */
                        return 0;
                }
 

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

Reply via email to