Author: bklaas
Date: Wed Apr 13 14:03:52 2011
New Revision: 9422

URL: http://svn.slimdevices.com/jive?rev=9422&view=rev
Log:
 r49983@DaddyMac (orig r9405):  adrian | 2011-04-03 04:49:51 -0500
 Bug: N/A
 Description: fix typo
 
 r50018@DaddyMac (orig r9407):  adrian | 2011-04-05 16:09:14 -0500
 Bug: N/A
 Description: C code to support higher speed network tests using streaming code 
rather than slimproto
 
 r50020@DaddyMac (orig r9409):  agrundman | 2011-04-07 11:59:43 -0500
 Fixed bug 16799, patch from Stephan Diestelhorst to fix pulseaudio playback on 
Ubuntu
 r50021@DaddyMac (orig r9410):  agrundman | 2011-04-07 12:14:02 -0500
 Fix squeezecenter_full which was breaking the build for some reason
 r50022@DaddyMac (orig r9411):  ayoung | 2011-04-08 03:20:31 -0500
 Fixed bug 12199: Song position indicator snaps back to old position for a 
moment upon seek 
 Mark the player as being in state waitingToPlay as soon as issuing a gototime 
command to the server or upon registering a touch on the progress-bar slider. 
This will defeat updates of the progress bar until the next (player)status 
notification arrives, which should have the correct new time.
 It is still possible to get a jump in the case that the Slider object has not 
yet delivered the notification that it has been touched (debounce of 
pseudo-mouse event), but this is pretty rare and only affects the touch 
interface.
 r50023@DaddyMac (orig r9412):  bklaas | 2011-04-08 13:02:20 -0500
 Fixed Bug: 17104
 Description: only 1px of menu item padding for top and bottom in controller 
skin, icon_list window
 
 r50069@DaddyMac (orig r9413):  adrian | 2011-04-10 11:37:39 -0500
 Bug: N/A
 Description: enable playback of new network test traffic - this uses streaming 
audio code and so more representation and lower cpu load than existing network 
test.  For the moment retain existing network test UI
 
 r50070@DaddyMac (orig r9414):  bklaas | 2011-04-11 17:31:40 -0500
 Fixed Bug: 17136
 Description: cancel the alarm on the server when back button is pressed to 
dismiss alarm popup
 
 r50071@DaddyMac (orig r9415):  bklaas | 2011-04-11 17:35:06 -0500
 Bug: n/a
 Description: revert unwanted checkin
 r50072@DaddyMac (orig r9416):  bklaas | 2011-04-11 17:36:43 -0500
 Bug: 17136
 Description: this checkin got missed accidentally
 add optional continueStream flag on stopAlarm method for player object
 
 r50073@DaddyMac (orig r9417):  bklaas | 2011-04-12 15:38:31 -0500
 Fixed Bug: 15515
 Description: correctly set self.alarmState in clock applet when alarmState 
notification comes through
 
 r50074@DaddyMac (orig r9418):  bklaas | 2011-04-12 15:41:10 -0500
 Bug: 15515
 Description: poll for playerstatus every 10 minutes
 
 r50083@DaddyMac (orig r9419):  bklaas | 2011-04-13 11:51:41 -0500
 Fixed Bug: 16663
 Description: require 6 consecutive failed states for audio decode status 
(i.e., nothing playing out the speaker) when an alarm is active and not in 
snooze
 
 also, rearrange a few log messages in AlarmSnooze to prevent over-the-top 
printing of console messages that didn't apply to the local player
 
 r50085@DaddyMac (orig r9420):  bklaas | 2011-04-13 16:00:50 -0500
 Bug: 17072
 Description: support for title in alertWindow showBriefly block
 support for not stacking alertWindow windows that have the same text to display
 
 r50090@DaddyMac (orig r9421):  bklaas | 2011-04-13 16:03:29 -0500
  r50019@DaddyMac (orig r9408):  blblack | 2011-04-06 12:25:34 -0500
  
  Comet.lua: rhttp code to set cachedIP from chttp was only present in one of 
two cases of _addPendingRequests+send(), presumably due to an earlier 
copy+paste and then the cachedIP fix only being applied to one copy.  This is 
now de-duplicated and the cachedIP fix applies to both cases.
  SocketHttp.lua: t_sendResolve state was being executed when sending requests 
on an already-connected socket.  This results in a spurious DNS request which 
updates t_tcp.address for this connection (possibly to a new IP, which is not 
the one currently connected to).  This in turn is the source of rhttp's 
cachedIP, which can lead to chttp+rhttp split to different destinations.  
t_sendDequeue now skips over both t_sendResolve and t_sendConnect when already 
connected.
  
  
 

Modified:
    7.6/branches/new-setup/   (props changed)
    
7.6/branches/new-setup/squeezeos/poky/meta-squeezeos/packages/squeezecenter_full/squeezecenter_full_svn.bb
    7.6/branches/new-setup/squeezeplay/src/luartmp-squeezeplay/rtmp.c
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
    7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/Comet.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
    
7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c
    7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/streambuf.c

Propchange: 7.6/branches/new-setup/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Wed Apr 13 14:03:52 2011
@@ -14,8 +14,8 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8423
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/private-branches/7.5.3-rc:9282
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:9394
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.6/trunk:9400
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:9408
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.6/trunk:9421
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.6/branches/new-setup/squeezeos/poky/meta-squeezeos/packages/squeezecenter_full/squeezecenter_full_svn.bb
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeos/poky/meta-squeezeos/packages/squeezecenter_full/squeezecenter_full_svn.bb?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeos/poky/meta-squeezeos/packages/squeezecenter_full/squeezecenter_full_svn.bb
 (original)
+++ 
7.6/branches/new-setup/squeezeos/poky/meta-squeezeos/packages/squeezecenter_full/squeezecenter_full_svn.bb
 Wed Apr 13 14:03:52 2011
@@ -2,13 +2,13 @@
 LICENSE = "GPL"
 
 PV = "7.6+svnr${SRCREV}"
-PR = "r14"
+PR = "r15"
 
-RDEPENDS += "perl perl-modules libcompress-raw-zlib-perl 
libclass-xsaccessor-perl libclass-xsaccessor-array-perl"
+RDEPENDS += "perl perl-modules libcompress-raw-zlib-perl 
libclass-xsaccessor-perl"
 RDEPENDS += "libdbi-perl sqlite3 libdbd-sqlite-perl"
 RDEPENDS += "libdigest-sha1-perl libjson-xs-perl libhtml-parser-perl"
-RDEPENDS += "libtemplate-toolkit-perl libxml-parser-perl libyaml-syck-perl 
libgd-perl"
-RDEPENDS += "libev-perl"
+RDEPENDS += "libtemplate-toolkit-perl libxml-parser-perl libyaml-syck-perl"
+RDEPENDS += "libev-perl libio-aio-perl libimage-scale-perl"
 RDEPENDS += "liblinux-inotify2-perl libaudio-scan-perl libsub-name-perl"
 
 # For performance measures
@@ -16,10 +16,13 @@
 
 # BROKEN: libencode-detect-perl
 
-SRC_URI = "${SQUEEZECENTER_SCM};module=trunk \
-       file://squeezecenter"
+SQUEEZECENTER_SVN_MODULE ?= "trunk"
+
+SRC_URI = "${SQUEEZECENTER_SCM};module=${SQUEEZECENTER_SVN_MODULE} \
+       file://squeezecenter \
+       file://custom-convert.conf"
        
-S = "${WORKDIR}/trunk"
+S = "${WORKDIR}/${SQUEEZECENTER_SVN_MODULE}"
 
 dirs755 = "${sysconfdir}/init.d \
        ${sysconfdir}/squeezecenter ${sysconfdir}/squeezecenter/prefs 
${sysconfdir}/squeezecenter/cache"
@@ -35,6 +38,7 @@
        # Remove duplicate modules under CPAN that were installed system-wide
        rm -r ${D}/${prefix}/squeezecenter/CPAN/arch
        rm -r ${D}/${prefix}/squeezecenter/CPAN/Audio
+       rm -r ${D}/${prefix}/squeezecenter/CPAN/Class/XSAccessor*
        rm -r ${D}/${prefix}/squeezecenter/CPAN/Compress
        rm -r ${D}/${prefix}/squeezecenter/CPAN/DBI.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/DBI
@@ -42,7 +46,7 @@
        rm -r ${D}/${prefix}/squeezecenter/CPAN/Digest
        rm -r ${D}/${prefix}/squeezecenter/CPAN/Encode
        rm -r ${D}/${prefix}/squeezecenter/CPAN/EV.pm
-       rm -r ${D}/${prefix}/squeezecenter/CPAN/GD*
+       rm -r ${D}/${prefix}/squeezecenter/CPAN/Font
        rm -r ${D}/${prefix}/squeezecenter/CPAN/HTML/Parser.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/HTML/Entities.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/HTML/Filter.pm
@@ -50,6 +54,7 @@
        rm -r ${D}/${prefix}/squeezecenter/CPAN/HTML/LinkExtor.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/HTML/PullParser.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/HTML/TokeParser.pm
+       rm -r ${D}/${prefix}/squeezecenter/CPAN/Image
        rm -r ${D}/${prefix}/squeezecenter/CPAN/JSON/XS.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/JSON/XS/Boolean.pm
        rm -r ${D}/${prefix}/squeezecenter/CPAN/XML/Parser.pm       # Note: 
must keep custom Encodings
@@ -89,6 +94,7 @@
                install -m 0755 -d ${D}$d
        done
        install -m 0755 ${WORKDIR}/squeezecenter 
${D}${sysconfdir}/init.d/squeezecenter 
+       install -m 0755 ${WORKDIR}/custom-convert.conf 
${D}/${prefix}/squeezecenter/custom-convert.conf
 }
 
 FILES_${PN} += "${prefix}"

Modified: 7.6/branches/new-setup/squeezeplay/src/luartmp-squeezeplay/rtmp.c
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/luartmp-squeezeplay/rtmp.c?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 7.6/branches/new-setup/squeezeplay/src/luartmp-squeezeplay/rtmp.c (original)
+++ 7.6/branches/new-setup/squeezeplay/src/luartmp-squeezeplay/rtmp.c Wed Apr 
13 14:03:52 2011
@@ -764,7 +764,7 @@
                if (recv_bytes > next_ack) {
                        u8_t *packet_template, packet[16];
 
-                       LOG_DEBUG(log_audio_decode, "sending ack: %ud", 
recv_bytes);
+                       LOG_DEBUG(log_audio_decode, "sending ack: %u", 
recv_bytes);
 
                        // send ack packet
                        packet_template = (u8_t *)

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 Wed Apr 13 14:03:52 2011
@@ -59,6 +59,7 @@
 
        self.debugRTCTime = timeToAlarm
        self.debugWOLTime = 0
+       self.failedAudioTicker = 0
        self.RTCAlarmTimer = Timer(timeToAlarm,
                        function ()
                                log:warn("RTC ALARM FIRING")
@@ -119,7 +120,7 @@
                self:_startTimer()
        end
 
-       self.decodeStatePoller = Timer(10000, 
+       self.decodeStatePoller = Timer(5000, 
                function ()
                        self:_pollDecodeState()
                end,
@@ -240,6 +241,15 @@
 
        log:warn('alarm_sledgehammerRearm(', caller,'): ', 
self.alarmInProgress, ' alarm in progress - audioState is ', status.audioState)
        if self.alarmInProgress and self.alarmInProgress ~= 'snooze' and 
status.audioState ~= 1 then
+               self.failedAudioTicker = self.failedAudioTicker + 1
+               log:warn('Audio failed! (', self.failedAudioTicker, ')')
+       else
+               self.failedAudioTicker = 0
+               log:warn('Audio now in good shape, reset ticker to ', 
self.failedAudioTicker)
+       end
+
+       if self.failedAudioTicker > 5 then
+               log:warn('Decode state bad ', self.failedAudioTicker, ' 
consecutive times. Trigger fallback alarm!')
                hammer = true
        end
 
@@ -258,11 +268,11 @@
 -- polling would eventually manifest the transition anyway...
 
 function notify_playerLoaded(self, player)
-       log:info("notify_playerLoaded(", player, ")")
        if not player then
                return
        end
        if player == self.localPlayer then
+               log:debug("notify_playerLoaded(", player, ")")
 --             self:_alarm_sledgehammerRearm('notify_playerLoaded')
                -- check for pending server alarm in case that one is pending 
instead, since we may have changed players to force 
                --       local control during a previous call to 
openAlarmWindow()
@@ -304,36 +314,38 @@
 
 
 function notify_playerModeChange(self, player, mode)
-       log:warn('notify_playerModeChange: player (', player,') mode has been 
changed to ', mode)
+       log:debug('notify_playerModeChange: player (', player,') mode has been 
changed to ', mode)
        if not player then
                return
        end
-       local status = decode:status()
-       log:warn('notify_playerModeChange: - audioState is ', status.audioState)
+       if player == self.localPlayer then
+               local status = decode:status()
+               log:warn('notify_playerModeChange: - audioState is ', 
status.audioState)
+       end
 end
 
 
 function notify_playerConnected(self, player)
-       log:warn('notify_playerConnected: ', player, ' ', self.alarmInProgress)
        if not player then
                return
        end
        if player == self.localPlayer then
+               log:warn('notify_playerConnected: ', player, ' ', 
self.alarmInProgress)
 --             self:_alarm_sledgehammerRearm('notify_playerConnected')
                self.server = player:getSlimServer()
                log:warn("notify_playerConnected(): setting self.server to: ", 
self.server)
        else
-               log:info('notify_playerConnected(): this notification player: 
', player, ' not for local player: ', self.localPlayer)
+               log:debug('notify_playerConnected(): this notification player: 
', player, ' not for local player: ', self.localPlayer)
        end
 end
 
 
 function notify_playerDisconnected(self, player)
-       log:warn('notify_playerDisconnected ', player, self.alarmInProgress)
        if not player then
                return
        end
        if player == self.localPlayer then
+               log:warn('notify_playerDisconnected ', player, 
self.alarmInProgress)
        end
 end
 
@@ -706,9 +718,9 @@
        
        self:_stopDecodeStatePoller()
 
-       if self.localPlayer:isConnected() and stopStream then
-               log:warn('_alarmOff: send stopAlarm to connected server')
-               self.localPlayer:stopAlarm()
+       if self.localPlayer:isConnected() then
+               log:warn('_alarmOff: tell server alarm is off, and only pause 
if stopStream is true')
+               self.localPlayer:stopAlarm(not stopStream)
        end
 
        if self.fallbackAlarmTimeout and self.fallbackAlarmTimeout:isRunning() 
then

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
 Wed Apr 13 14:03:52 2011
@@ -101,7 +101,8 @@
        if not player:isLocal() then
                return
        end
-       self.alarmSet = alarmSet
+       self.alarmSet = player:getAlarmState()
+       log:debug('Setting self.alarmSet to ', self.alarmSet)
 
        self:Draw()
 end

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 Wed Apr 13 14:03:52 2011
@@ -1456,6 +1456,7 @@
        
        self.progressSlider = Slider('npprogressB', 0, 100, 0,
                function(slider, value, done)
+                       self.player:setWaitingToPlay(1)
                        self.gotoElapsed = value
                        self.gotoTimer:restart()
                end)

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
 Wed Apr 13 14:03:52 2011
@@ -178,6 +178,8 @@
 
        s.menu.itemHeight           = c.PORTRAIT_LINE_ITEM_HEIGHT
        s.icon_list.menu.itemHeight = c.PORTRAIT_LINE_ITEM_HEIGHT
+       -- Bug 17104: change the padding in icon_list to 1 px top/bottom 
(landscape is 2 px top/bottom)
+       s.icon_list.menu.item.padding = { 10, 1, 4, 1 }
 
        -- hide alarm icon on controller status bar, no room
        s.iconbar_group.order = { 'play', 'repeat_mode', 'shuffle', 'sleep', 
'battery', 'wireless' } --'repeat' is a Lua reserved word

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
 Wed Apr 13 14:03:52 2011
@@ -117,6 +117,8 @@
                slimproto:capability("Spdirect", cap)
        end
 
+       slimproto:capability("test")
+
        -- signal we are Rtmp capable, but don't load module until used
        slimproto:capability("Rtmp", 2)
 
@@ -470,6 +472,10 @@
                Rtmp = require("jive.audio.Rtmp")
                m.read  = Rtmp.read
                m.write = Rtmp.write
+       elseif self.mode == 'n' then
+               -- network test, use specific read method
+               m.read = m.readToNull
+               m.write = m._streamWrite
        else
                -- use standard stream methods
                m.read  = m._streamRead
@@ -675,6 +681,10 @@
                                self.slimproto:sendStatus('STMc')
                                self.slimproto:sendStatus('STMn')
                        end
+               elseif data.mode == 'n' then
+                       -- network test stream - only stream, don't decode
+                       log:info("network test stream")
+                       self:_streamConnect(serverIp, data.serverPort)
                else
                        -- standard stream - start the decoder and connect
                        decode:start(string.byte(data.mode),

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/Comet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/Comet.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/Comet.lua 
(original)
+++ 7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/Comet.lua 
Wed Apr 13 14:03:52 2011
@@ -344,10 +344,12 @@
 
 
 -- Send any pending subscriptions and requests
-_sendPendingRequests = function(self)
+_sendPendingRequests = function(self, data)
 
        -- add all pending unsub requests, and any others we need to send
-       local data = {}
+       if not data then
+               data = {}
+       end
        _addPendingRequests(self, data)
        
        -- Only continue if we have some data to send
@@ -760,26 +762,7 @@
                table.insert(data, v)
        end
 
-       -- Add any other pending requests to the outgoing data
-       _addPendingRequests(self, data)
-
-       -- Only continue if we have some data to send
-       if data[1] then
-
-               if log:isDebug() then
-                       log:debug("Sending pending request(s):")
-                       debug.dump(data, 5)
-               end
-
-               local req = CometRequest(
-                       _getEventSink(self),
-                       self.uri,
-                       data
-               )
-
-               self.rhttp:fetch(req)
-       end
-
+       _sendPendingRequests(self, data)
        _state(self, CONNECTED)
 end
 

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua
 Wed Apr 13 14:03:52 2011
@@ -181,7 +181,11 @@
 
        if self.t_httpSendRequest then
                log:debug(self, " send processing ", self.t_httpSendRequest)
-               self:t_nextSendState(true, 't_sendResolve')
+               if self:connected() then
+                       self:t_nextSendState(true, 't_sendRequest')
+               else
+                       self:t_nextSendState(true, 't_sendResolve')
+               end
                return
        end
 end
@@ -248,14 +252,12 @@
 function t_sendConnect(self)
        log:debug(self, ":t_sendConnect()")
 
-       if not self:connected() then
-               local err = socket.skip(1, self:t_connect())
-       
-               if err then
-                       log:error(self, ":t_sendConnect: ", err)
-                       self:close(err)
-                       return
-               end
+       local err = socket.skip(1, self:t_connect())
+       
+       if err then
+               log:error(self, ":t_sendConnect: ", err)
+               self:close(err)
+               return
        end
                
        self:t_nextSendState(true, 't_sendRequest')

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua 
(original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua 
Wed Apr 13 14:03:52 2011
@@ -989,7 +989,7 @@
        self.slimServer.comet:startBatch()
        
        -- subscribe to player status updates
-       local cmd = { 'status', '-', 10, 'menu:menu', 'useContextMenu:1', 
'subscribe:0' }
+       local cmd = { 'status', '-', 10, 'menu:menu', 'useContextMenu:1', 
'subscribe:600' }
        self.slimServer.comet:subscribe(
                '/slim/playerstatus/' .. self.id,
                _getSink(self, cmd),
@@ -1316,18 +1316,29 @@
        self:updateIconbar()
 end
 
-function _alertWindow(self, textValue)
-
-       local window = Window('help_list', ' ')
-       window:setAllowScreensaver(false)
-        window:showAfterScreensaver()
-       local text = Textarea("text", textValue)
-       window:addWidget(text)
-
-       local s = {}
-       s.window = window
-       self:tieWindow(window)
-       return s
+function _alertWindow(self, title, textValue)
+
+       local showMe = true
+       local currentWindow = Window:getTopNonTransientWindow()
+       if currentWindow and currentWindow:getWindowId() == textValue then
+               showMe = false
+       end
+
+       if showMe then
+               local window = Window('help_list', title)
+               window:setAllowScreensaver(false)
+               window:showAfterScreensaver()
+               local text = Textarea("text", textValue)
+               window:setWindowId(textValue)
+               window:addWidget(text)
+
+               local s = {}
+               s.window = window
+               self:tieWindow(window)
+               return s
+       else
+               return nil
+       end
 end
 
 
@@ -1358,7 +1369,11 @@
                -- this showBriefly should be displayed unless there's a good 
reason not to
                local showMe = true
                if alertWindow then
-                       s = self:_alertWindow(textValue)
+                       local title = display['title'] or ''
+                       s = self:_alertWindow(title, textValue)
+                       if not s then
+                               showMe = false
+                       end
 
                elseif special then
                        s = self.popupIcon
@@ -1466,11 +1481,13 @@
        self:updateIconbar()
 end
 
-function stopAlarm(self)
+-- optional continueAudio flag cancels alarm without pausing audio
+function stopAlarm(self, continueAudio)
        if not self.state then return end
 
-       -- stopAlarm pauses audio
-       self:pause()
+       if not continueAudio then
+               self:pause()
+       end
 
        self.alarmState = 'none'
        self:call({'jivealarm', 'stop:1'})
@@ -1509,6 +1526,11 @@
 
 function isWaitingToPlay(self)
        return self.waitingToPlay
+end
+
+
+function setWaitingToPlay(self, value)
+       self.waitingToPlay = value
 end
 
 
@@ -1727,6 +1749,7 @@
        self.trackTime = time
        log:debug("Sending player:time(", time, ")")
        self:send({'time', time })
+       self:setWaitingToPlay(1)
        return nil
 end
 

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c
 (original)
+++ 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa_backend.c
 Wed Apr 13 14:03:52 2011
@@ -132,6 +132,9 @@
 
        /* parent */
        pid_t parent_pid;
+
+       /* MMAP output available? */
+       char has_mmap;
 };
 
 #define PCM_FRAMES_TO_BYTES(frames) (snd_pcm_frames_to_bytes(state->pcm, 
(frames)))
@@ -667,6 +670,18 @@
                                state->playback_device,
                                SND_PCM_ACCESS_MMAP_INTERLEAVED,
                                sample_rate);
+               state->has_mmap = 1;
+
+               if (err < 0) {
+                       /* Retry without MMAP */
+                       err = _pcm_open(state,
+                                       &state->pcm,
+                                       mode,
+                                       state->playback_device,
+                                       SND_PCM_ACCESS_RW_INTERLEAVED,
+                                       sample_rate);
+                       state->has_mmap = 0;
+               }
 
                if (err < 0) {
                        return err;
@@ -745,6 +760,7 @@
        snd_pcm_status_t *status;
        int err, count = 0, count_max = 441, first = 1;
        u32_t delay, do_open = 1;
+       void *buf = NULL;
 
        LOG_DEBUG("audio_thread_execute");
 
@@ -870,7 +886,6 @@
                        const snd_pcm_channel_area_t *areas;
                        snd_pcm_uframes_t frames, offset;
                        snd_pcm_sframes_t commitres;
-                       void *buf;
 
                        frames = size;
 
@@ -878,17 +893,24 @@
                                capture_read(state, frames);
                        }
 
-                       if ((err = snd_pcm_mmap_begin(state->pcm, &areas, 
&offset, &frames)) < 0) {
-                               LOG_WARN("xrun (snd_pcm_mmap_begin)");
-                               if ((err = snd_pcm_recover(state->pcm, err, 1)) 
< 0) {
-                                       LOG_ERROR("mmap begin failed: %s", 
snd_strerror(err));
-                               }
-                               first = 1;
+                       if (state->has_mmap) {
+                               if ((err = snd_pcm_mmap_begin(state->pcm, 
&areas, &offset, &frames)) < 0) {
+                                       LOG_WARN("xrun (snd_pcm_mmap_begin)");
+                                       if ((err = snd_pcm_recover(state->pcm, 
err, 1)) < 0) {
+                                               LOG_ERROR("mmap begin failed: 
%s", snd_strerror(err));
+                                       }
+                                       first = 1;
+                               }
                        }
 
                        TIMER_CHECK("BEGIN");
 
-                       buf = ((u8_t *)areas[0].addr) + (areas[0].first + 
offset * areas[0].step) / 8;
+                       if (state->has_mmap) {
+                               buf = ((u8_t *)areas[0].addr) + (areas[0].first 
+ offset * areas[0].step) / 8;
+                       } else {
+                               if (!buf)
+                                       buf = 
malloc(PCM_FRAMES_TO_BYTES(state->period_size));
+                       }
 
                        if (state->flags & FLAG_STREAM_PLAYBACK) {
                                decode_audio_lock();
@@ -960,14 +982,27 @@
 
                        TIMER_CHECK("EFFECTS");
 
-                       commitres = snd_pcm_mmap_commit(state->pcm, offset, 
frames); 
-                       if (commitres < 0 || (snd_pcm_uframes_t)commitres != 
frames) { 
-                               LOG_WARN("xrun (snd_pcm_mmap_commit) err=%ld", 
commitres);
-                               if ((err = snd_pcm_recover(state->pcm, 
commitres, 1)) < 0) {
-                                       LOG_ERROR("mmap commit failed: %s", 
snd_strerror(err));
-                               }
-                               first = 1;
-                       }
+                       if (state->has_mmap) {
+                               commitres = snd_pcm_mmap_commit(state->pcm, 
offset, frames); 
+                               if (commitres < 0 || 
(snd_pcm_uframes_t)commitres != frames) { 
+                                       LOG_WARN("xrun (snd_pcm_mmap_commit) 
err=%ld", commitres);
+                                       if ((err = snd_pcm_recover(state->pcm, 
commitres, 1)) < 0) {
+                                               LOG_ERROR("mmap commit failed: 
%s", snd_strerror(err));
+                                       }
+                                       first = 1;
+                               }
+                       } else {
+                               commitres = snd_pcm_writei(state->pcm, buf, 
frames); 
+                               if (commitres < 0 || 
(snd_pcm_uframes_t)commitres != frames) { 
+                                       LOG_WARN("xrun (snd_pcm_writei) 
err=%ld", commitres);
+                                       if ((err = snd_pcm_recover(state->pcm, 
commitres, 1)) < 0) {
+                                               LOG_ERROR("sound write failed: 
%s", snd_strerror(err));
+                                       }
+                                       first = 1;
+                               }
+                       }
+
+
                        size -= frames;
 
                        TIMER_CHECK("COMMIT");
@@ -975,6 +1010,7 @@
        }
 
  thread_error:
+       if (!state->has_mmap && buf) free(buf);
        free(status);
 
        LOG_ERROR("Audio thread exited");

Modified: 
7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/streambuf.c
URL: 
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/streambuf.c?rev=9422&r1=9421&r2=9422&view=diff
==============================================================================
--- 7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/streambuf.c 
(original)
+++ 7.6/branches/new-setup/squeezeplay/src/squeezeplay/src/audio/streambuf.c 
Wed Apr 13 14:03:52 2011
@@ -787,6 +787,37 @@
 }
 
 
+/* read bytes from the streaming socket and discard - used by network test to 
measure network throughput*/
+static int stream_readtonullL(lua_State *L) {
+       struct stream *stream;
+       char buf[4094];
+       int n;
+       /*
+        * 1: Stream (self)
+        */
+
+       stream = lua_touserdata(L, 1);
+
+       n = recv(stream->fd, buf, sizeof(buf), 0);      
+
+       if (n > 0) {
+               fifo_lock(&streambuf_fifo);
+               streambuf_bytes_received += n;
+               fifo_unlock(&streambuf_fifo);
+               lua_pushinteger(L, n);
+               return 1;
+       } else if (n == -1 && errno == EAGAIN) {
+               lua_pushinteger(L, 0);
+               return 1;
+       } else {
+               CLOSESOCKET(stream->fd);
+               lua_pushnil(L);
+               lua_pushstring(L, strerror(n));
+               return 2;
+       }
+}
+
+
 static int stream_setstreamingL(lua_State *L) {
        /*
         * 1: Stream (self)
@@ -845,6 +876,7 @@
        { "write", stream_writeL },
        { "feedFromLua", stream_feedfromL },
        { "readToLua", stream_readtoL },
+       { "readToNull", stream_readtonullL },
        { "setStreaming", stream_setstreamingL },
        { NULL, NULL }
 };

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

Reply via email to