Author: bklaas
Date: Tue Jan 12 14:37:07 2010
New Revision: 8322

URL: http://svn.slimdevices.com/jive?rev=8322&view=rev
Log:
 r38...@daddymac-520 (orig r8316):  michael | 2010-01-12 06:30:26 -0500
 Bug: n/a
 Description: don't try to use SN based resizing if image in slideshow has 
relative path, fetch it from the connected server instead
 r38...@daddymac-520 (orig r8318):  michael | 2010-01-12 12:34:29 -0500
 Bug: n/a
 Description: don't animate slideshows with only one item
 r38...@daddymac-520 (orig r8321):  bklaas | 2010-01-12 16:36:56 -0500
  r38...@daddymac-520 (orig r8317):  bklaas | 2010-01-12 10:58:35 -0500
  Bug: 14870
  Description: For now, pull all log messages out of (if self.localPlayer) 
clauses.
  remove 59 second alarm window hide timer
  remove streamSuccessChecker, as it is replaced by the decodeState poller
  
  r38...@daddymac-520 (orig r8319):  felix | 2010-01-12 13:54:13 -0500
  Bug: 11455 
  Description:  
  - Reduced DNS timeout to 10 seconds (was 2 minutes). My tests on Jive, Baby 
and Touch showed that a 10 seconds timeout is still enough to allow the message 
pipe to empty even if a lot of DNS resolve requests are queued up while the 
network is down.
  - Fixed slow memory leak in DNS resolver thread (occured while the network 
was down)
  
  r38...@daddymac-520 (orig r8320):  bklaas | 2010-01-12 16:33:59 -0500
  Bug: 14870
  Description: use decode:status().audioState to check if something's currently 
playing. LocalPlayer:isStreaming() is not the correct check, nor is 
decode:status().decodeState
  
 

Modified:
    7.6/trunk/   (props changed)
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
    7.6/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c

Propchange: 7.6/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Tue Jan 12 14:37:07 2010
@@ -12,8 +12,8 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-autoswitch:5831
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8312
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8313
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8320
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8321
 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/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=8322&r1=8321&r2=8322&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 Tue Jan 12 14:37:07 2010
@@ -70,20 +70,11 @@
                        end,
                        true
        )
-       self.streamSuccessChecker = Timer(20000,
-                       function ()
-                               if self.alarmInProgress == 'server' and not 
self.localPlayer:isStreaming() then
-                                       self:soundFallbackAlarm()
-                               end
-                       end,
-                       true
-       )
        
        if startTimer then
                self:_startTimer()
        end
 
-       self.debugDecodeState = true
        self.decodeStatePoller = Timer(10000, 
                function ()
                        self:_pollDecodeState()
@@ -96,6 +87,7 @@
 
 function notify_playerAlarmState(self, player, alarmState, alarmNext)
 
+       log:warn('notify_playerAlarmState received for ', player, ' with 
alarmState of ', alarmState)
        if player:isLocal() then
                log:warn('**************************** notify_playerAlarmState 
received: ', alarmState, ' ', alarmNext)
                if alarmState == 'active' then
@@ -193,14 +185,15 @@
        if self.alarmInProgress == 'server' then
                local status = decode:status()
                -- just informational
-               log:warn('alarm_sledgehammerRearm(', caller,'): SERVER alarm in 
progress - decodeState is ', status.decodeState, ' and streaming is ', 
self.localPlayer:isStreaming())
+               log:warn('alarm_sledgehammerRearm(', caller,'): SERVER alarm in 
progress - audioState is ', status.audioState)
                
-               if not self.localPlayer:isStreaming() then
+               if not status.audioState == 1 then
                        log:warn('alarm_sledgehammerRearm(', caller,'): SERVER 
alarm in progress, but stream is nil - firing fallback alarm')
                        hammer = true
                end
        -- restart audio on any state transition from SqueezeOS, but not on 
local polls 
-       elseif self.alarmInProgress == 'rtc' and caller ~= '_pollDecodeState' 
then
+       --elseif self.alarmInProgress == 'rtc' and caller ~= '_pollDecodeState' 
then
+       elseif self.alarmInProgress == 'rtc' then
                log:warn('alarm_sledgehammerRearm(', caller,'): RTC alarm 
already in progress - restarting alarm audio asynchronously')
                hammer = true
        end
@@ -226,8 +219,8 @@
 -- polling would eventually manifest the transition anyway...
 
 function notify_playerLoaded(self, player)
+       log:info("notify_playerLoaded(", player, ")")
        if player == self.localPlayer then
-               log:info("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()
@@ -239,33 +232,31 @@
 
 
 function notify_playerCurrent(self, player)
+       log:info("notify_playerCurrent(", player, ")")
        if player == self.localPlayer then
-               log:info("notify_playerCurrent(", player, ")")
 --             self:_alarm_sledgehammerRearm('notify_playerCurrent')
        end
 end
 
 
 function notify_playerModeChange(self, player, mode)
+       log:warn('notify_playerModeChange: player (', player,') mode has been 
changed to ', mode)
+       local status = decode:status()
+       log:warn('notify_playerModeChange: - audioState is ', status.audioState)
+end
+
+
+function notify_playerConnected(self, player)
+       log:warn('notify_playerConnected: ', player, ' ', self.alarmInProgress)
        if player == self.localPlayer then
-               log:warn('notify_playerModeChange: player (', player,') mode 
has been changed to ', mode)
-               local status = decode:status()
-               log:warn('notify_playerModeChange: - decodeState is ', 
status.decodeState,' and streaming is ', self.localPlayer:isStreaming())
-       end
-end
-
-
-function notify_playerConnected(self, player)
+--             self:_alarm_sledgehammerRearm('notify_playerConnected')
+       end
+end
+
+
+function notify_playerDisconnected(self, player)
+       log:warn('notify_playerDisconnected ', player, self.alarmInProgress)
        if player == self.localPlayer then
-               log:warn('notify_playerConnected: ', player, ' ', 
self.alarmInProgress)
---             self:_alarm_sledgehammerRearm('notify_playerConnected')
-       end
-end
-
-
-function notify_playerDisconnected(self, player)
-       if player == self.localPlayer then
-               log:warn('notify_playerDisconnected ', player, 
self.alarmInProgress)
        end
 end
 
@@ -348,9 +339,9 @@
 function _pollDecodeState(self)
        local status = decode:status()
        if self.localPlayer:isConnected() then
-               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
decodeState is ', status.decodeState, ' and streaming is ', 
self.localPlayer:isStreaming())
-       else
-               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
decodeState is ', status.decodeState, ' and no current player')
+               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
audioState is ', status.audioState)
+       else
+               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
audioState is ', status.audioState)
        end
 
        self:_alarm_sledgehammerRearm('_pollDecodeState')       
@@ -403,7 +394,7 @@
                -- just informational stuff for now
                local status = decode:status()
                -- just informational
-               log:warn('openAlarmWindow: called with `server` - decodeState 
is ', status.decodeState, ' and streaming is ', self.localPlayer:isStreaming())
+               log:warn('openAlarmWindow: called with `server` - audioState is 
', status.audioState)
 
                if self.alarmInProgress == 'rtc' then
                        log:warn('openAlarmWindow: called with `server` while 
`rtc` alarm in progress!')
@@ -411,19 +402,10 @@
                        log:error('CALL STACK TRAP: ')
                end
                
-               if self.debugDecodeState then
-                       if self.decodeStatePoller:isRunning() then
-                               self.decodeStatePoller:restart()
-                       else
-                               self.decodeStatePoller:start()
-                       end
-               end
-
-               if not self.localPlayer:isStreaming() then
-                       -- check in 20 secs if we are streaming anything, and 
if not, fire fallback alarm
-                       -- this used to be done server-side, but that has been 
removed
-                       log:info('openAlarmWindow: starting stream success 
check timer. in 20 seconds if alarm is still active and stream has failed, 
client-side fallback alarm will be fired')
-                       self.streamSuccessChecker:start()
+               if self.decodeStatePoller:isRunning() then
+                       self.decodeStatePoller:restart()
+               else
+                       self.decodeStatePoller:start()
                end
 
 
@@ -505,9 +487,6 @@
 
        menu:setHeaderWidget(headerGroup)
 
-        -- the alarm notification window should not endure forever; hide after 
59 seconds
-        window:addTimer(59000, function() self:_hideAlarmWindow() end)
-
        window:addWidget(menu)
        window:setShowFrameworkWidgets(false)
        window:setAllowScreensaver(false)

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua?rev=8322&r1=8321&r2=8322&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua 
(original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua 
Tue Jan 12 14:37:07 2010
@@ -143,5 +143,9 @@
        return self.imgFiles[self.currentImage]
 end
 
+function getImageCount(self)
+       return #self.imgFiles
+end
+
 function free(self)
 end

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua?rev=8322&r1=8321&r2=8322&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
 Tue Jan 12 14:37:07 2010
@@ -27,8 +27,8 @@
 local math                     = require("math")
 local table                    = require("jive.utils.table")
 local string           = require("jive.utils.string")
-local json              = require("json")
-local debug                  = require("jive.utils.debug")
+local json          = require("json")
+local debug         = require("jive.utils.debug")
 local lfs                      = require('lfs')
 local Group                    = require("jive.ui.Group")
 local Keyboard         = require("jive.ui.Keyboard")
@@ -36,11 +36,11 @@
 local Textinput     = require("jive.ui.Textinput")
 local Window        = require("jive.ui.Window")
 local SocketHttp       = require("jive.net.SocketHttp")
+local SlimServer    = require("jive.slim.SlimServer")
 local RequestHttp      = require("jive.net.RequestHttp")
 local URL              = require("socket.url")
 local Surface          = require("jive.ui.Surface")
 local Process          = require("jive.net.Process")
-local Player             = require("jive.slim.Player")
 local Framework                = require("jive.ui.Framework")
 
 local jnt = jnt
@@ -60,7 +60,6 @@
        obj.imgFiles = {}
 
        obj.serverData = serverData
-
 
        obj.imageDataHistory = {}
        obj.imageDataHistoryMax = 30
@@ -180,6 +179,18 @@
                string.find(urlString, "^http://10%.";)
        ) then
                -- use raw urlString
+       
+       elseif not string.find(urlString, "^http://";) then
+               -- url on current server
+               local server = SlimServer:getCurrentServer()
+               
+               if server then
+                       local ip, port = server:getIpPort()
+                       if ip and port then
+                               urlString = "http://"; .. ip .. ":" .. port .. 
"/" .. urlString
+                       end
+               end
+               
        else
                --use SN image proxy for resizing
                urlString = 'http://' .. jnt:getSNHostname() .. 
'/public/imageproxy?w=' .. screenWidth .. '&h=' .. screenHeight .. '&f=' .. ''  
.. '&u=' .. string.urlEncode(urlString)

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua?rev=8322&r1=8321&r2=8322&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
 Tue Jan 12 14:37:07 2010
@@ -547,15 +547,18 @@
                --no iconbar
                self.window:setShowFrameworkWidgets(false)
 
-               -- start timer for next photo in 'delay' milliseconds
-               local delay = self:getSettings()["delay"]
-               self.nextSlideTimer = self.window:addTimer(delay,
-                       function()
-                               
self.imgSource:nextImage(self:getSettings()["ordering"])
-                               self:displaySlide()
-                       end)
+               -- if we have more than one picture, start slideshow
+               if self.imgSource:getImageCount() > 1 then
+                       -- start timer for next photo in 'delay' milliseconds
+                       local delay = self:getSettings()["delay"]
+                       self.nextSlideTimer = self.window:addTimer(delay,
+                               function()
+                                       
self.imgSource:nextImage(self:getSettings()["ordering"])
+                                       self:displaySlide()
+                               end)
+               end
        else
-               file = self.imgSource:getCurrentImagePath()
+               file = self.imgSource:getCurrentImagePath() or 'unknown'
                log:info("Invalid image object found: " .. file)
 
                
self.imgSource:popupMessage(self:string("IMAGE_VIEWER_INVALID_IMAGE"), file)

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c?rev=8322&r1=8321&r2=8322&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c Tue Jan 12 
14:37:07 2010
@@ -23,7 +23,22 @@
 
 #endif
 
-#define RESOLV_TIMEOUT (2 * 60 * 1000) /* 2 minutes */
+/* fm - 01/12/2010
+Userland DNS resolve requests are queued into a pipe in jiveL_dns_write(), then
+dns_resolver_thread() reads the pipe and calls gethostbyaddr() or 
gethostbyname().
+Both of these functions are blocking and can take a couple of seconds to 
return,
+especially if the network is down.
+To allow the pipe to empty if a lot of DNS requests are issued while the 
network
+is down a 'shortcut' is taken as long as the following timeout is active. The
+shortcut path doesn't call the blocking functions but just reads from the pipe
+and returns the last error code again.
+The timeout was set to 2 minutes which I found in my tests on Jive, Baby and
+Touch not to be necessary to make sure the pipe gets emptied. 10 seconds seem
+to be enough.
+The 10 seconds timeout also makes reconnecting a lot quicker when the network 
is
+re-established. 
+*/
+#define RESOLV_TIMEOUT (10 * 1000) /* 10 seconds (was 2 minutes) */
 
 
 /*
@@ -208,6 +223,7 @@
                        
                        if (now - failed_timeout < RESOLV_TIMEOUT) {
                                write_str(fd, failed_error);
+                               free(buf);
                                continue;
                        }
                }

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

Reply via email to