INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MC 19 / 20 seems to be inconsistent with Samsung Series (6) F UE32H6400  (Read 2537 times)

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52

DNLA MC device interaction issue.

TV Model:

Samsung Series (6) F UE32H6400

All MC 19 and 20 DNLA delivered content plays without an issue. DNLA streams pauses plays perfectly.
MC runs in server mode on the desktop of a headless server computer. Interaction is via JRemote.

Consider the following sequence.

MC is running 24x7 on the ‘server’ in idle headless session 0.

The TV is started and renders a film for a while and is then shut off of the evening.
The problem comes the next time the TV is switched on. MC is unable to present the device correctly – it repeatedly appears and then disappears. While in this state if I attempt to send content to the renderer via DNLA I get an error from MC stating the “there is a problem connecting to the device”. If I then switch off the TV and switch it on again I get the same problem.

If I restart MC this issue disappears, until I switch off the TV and the switch it on again, when the problem re-occurs.
In summary If I leave the TV on all the time and recycle the MC process between rendering attempts the MC process behaves as expected and all content is correctly rendered and controlled. If however MC is not recycled it can only correctly present and control (connect to) the TV device the FIRST time it is discovered by MC and not subsequently. There must be some state in MC, floating around somehow, which is destroyed on process exit.

Don’t know how to troubleshoot this – the TV is brand new !

edit: In case there is a question - its all hardwired over Cat 5 Ethernet - no wireless involved.
Logged

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392

Try setting up you LAN router so that the TV is getting a fixed IP address (in other words tell the router to reserve that address for the TV)
Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52

Thank you - it is statically assigned already.
Logged

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392

Thank you - it is statically assigned already.

You may need to take this issue up with Samsung..

Background: in UPnP there are two mechanisms for device discovery -- namely NOTIFY done by the renderer (i.e. your TV) and M-SEARCH done by the control point (i.e. MC)

  • When a Renderer first comes on line it must send a NOTIFY Alive message with a certain validity time period.
  • Before the Alive time has expired, if the Renderer is still on line, it must send another NOTIFY Alive message to refresh its validity time period.
  • If the Renderer goes off line, it must send a NOTIFY ByeBye message; and when it comes back on line it must send a NOTIFY Alive as above.
  • When a Control Point comes online, it sends an M-SEARCH message, to which all renderers (if they are online) must respond.

So based on what you describe, it seems that when your TV goes to sleep it stops sending its NOTIFY Alive messages, and/or it fails to send a NOTIFY ByeBye message followed by NOTIFY Alive message when it wakes. Therefore as far as MC is concerned the TV has "disappeared into limbo", and so MC no longer knows how to send commands to it. And only when you force terminate and restart MC again does this force MC to send a full scale M-SEARCH request (which once more rediscovers the TV properly)...

EDIT:  It is possible that sometime after the TV has woken from sleep, it may once more realize that its Alive notifications have expired, and it may send them again. In which case MC may once more get a stable connection to the TV. The worst case time out for Alive renewals is 1800 seconds (30 minutes). So you can check by waiting for that length of time to see if the TV does indeed come back stable in MC within that time.

EDIT 2:  Another possibility might be that your TV is sending its alive renewals, but that your router is failing to route them. These are UDP multi-cast messages, and some routers have the "feature" to block multi-casts...
Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52

Hi Andrew, really appreciate your responsiveness and in-depth insights.

I figured it's some nastiness deep in the TV code, my Bravia works no problem! I love the new TV and I got a good deal on it so frankly I am going to workaround it in this instance.
I came up with this PowerShell solution, which I run from a scheduled task - hope it helps someone else if they get into similar woes.


Edit - came up with a more complete version that actually is capable of working out if the server is streaming specifically to the T.V. or not.
This version therefore relies on:
VS 2013 runtime library.
pscap - which is a custom PowerShell module....

# start at 9 am (the earliest likey time we start streaming a movie.) Scheduled Task action =  Powershell.exe (argument section) = -windowstyle hidden c:\myscript.ps1

# See if it's running and if not - start it.
if (get-process | where {$_.name -like 'media * 19'}) {Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Information –EventID 0 –Message “JRiver Already Running.”} else {

    start-process 'C:\Program Files (x86)\J River\Media Center 19\Media Center 19.exe' -ArgumentList '/boot'
    # Report.
    if (get-process | where {$_.name -like 'media * 19'}) {
        Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Information –EventID 0 –Message “JRiver sucessfully Started.”}
        else
        {Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Error –EventID 3 –Message “JRiver NOT sucessfully Started.”}
}


$count = 0
$sw = [Diagnostics.Stopwatch]::StartNew()

DO {

# Is the TV alive ?
 if (test-connection -count 1 192.168.1.76 -quiet) {

       # It is alive - therefore are we streaming or not?
       #Testing shows at idle the trafic over 100 seconds is around 5k per second for SOAP and other noise - when the TV is on.
       #We'll NEVER stream a film at 10k per second and this gives us a comfortable margin. Test to see if the average bytes over 10 seconds is more than 100k.

       start-process 'Nmcap' -wait -WindowStyle Hidden -ArgumentList '/network * /capture tcp /file "D:\Sysinternals\server.cap" /StopWhen /TimeAfter 10 seconds'
       if ((((Get-CaptureP2PStats -CaptureFile "D:\Sysinternals\server.cap") | where {$_.source -like '192.168.1.120' -and $_.destination -like '192.168.1.76'}).bytes /1kb -shr 0) -gt '100') {
               
                # Cleanup
                Remove-Item "D:\Sysinternals\server.cap" -ErrorAction Ignore

                # OK we are streaming to the TV so we need to kill MC after were done streaming.
                Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Information –EventID 2 –Message “JRiver is detected as streaming to 192.168.1.76 - waiting for exit.”
                DO
                # Ping the TV every 10 minutes to see if it's been switched off yet. . .
                {
                $ping = test-connection -count 1 192.168.1.76 -quiet
                Sleep 600
                } until (!$ping)
               
                # TV is off - see if we are streaming to something else at all. . .
               
                DO
                {
                $still_streaming = '1'
               
                # Testing shows that MC periodically generates a few frames of 2k per second when completely idle - extending test period to 60 sec to compensate.
                # a 64k MP3 file is 8k per second on the wire so if were over that - were streaming.

                $bandwidth_in_use = Get-Counter -Counter "\process(media center 19)\io other bytes/sec" -MaxSamples 60
                $bandwidth_in_use |% {$total_bytes += [convert]::toint32((($_.readings -split ':')[1]) -shr 0,10)}
                if (($total_bytes / $bandwidth_in_use.count) -gt '8192') {

                    # We are streaming - wait 10 mins before checking again that we have finished streaming. . .
                    Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Information –EventID 2 –Message “JRiver is detected as streaming - waiting for exit.”
                    remove-variable total_bytes
                    $still_streaming = '1'
                    Sleep 600
                    }
                    else
                    {
                    remove-variable total_bytes
                    $still_streaming = '0'
                    }
                } while ($still_streaming -eq '1')
               
                # We are no longer streaming stop MC!
                get-process | where {$_.name -like 'media * 19'} | stop-process
               
                #Report.
                if (get-process | where {$_.name -like 'media * 19'}) {
                    Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Error –EventID 3 –Message “JRiver NOT sucessfully Terminated.”}
                    else
                    {Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Information –EventID 1 –Message “JRiver sucessfully terminated.”}
               
                sleep 2

                # Restart MC.
                start-process 'C:\Program Files (x86)\J River\Media Center 19\Media Center 19.exe' -ArgumentList '/boot'

                #Report.
                if (get-process | where {$_.name -like 'media * 19'}) {
                    Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Information –EventID 0 –Message “JRiver sucessfully Started.”}
                    else
                    {Write-EventLog –LogName Application –Source "JRiver-monitoring" –EntryType Error –EventID 3 –Message “JRiver NOT sucessfully Started.”}
          }
       
    }

# If the TV is alive we end up here and incriment the count and wait for 10 minutes before checking a second time to see if we are streaming to it. . .
Remove-Item "D:\Sysinternals\server.cap" -ErrorAction Ignore

$count ++
sleep 600
$exit = '0'
"`$count is $count"
# After 77 times through the loop which we will reach in 13 hours if the TV is never on - set out exit variable = 1.
if ($count -ge '83') {$exit = '1'}

# OR (since we could get stuck for hours in other DO loops) for a total of 13 hours total runtime.
if ($sw.elapsed.ticks -ge '504000000000') {$exit = '1'}

} until ($exit -eq '1')
$sw.stop()



To install pscap is a bit of pain - here are some notes.
==================

· Create folder PSCap under $pshome\Modules
· Place the binary (x86 or x64) for your platform into newly created folder, along with PSCap.psd1 and PSCap.format.ps1xml
import the module PSCap into your Powershell session

Edit the pscap.psd1 and set  PowerShellHostVersion = '3.0'

How to load a custom module into PowerShell.

See if a custom module is blocked - switch into the directory where the module is located
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\pscap

ls . -r | get-item -Stream Zone.Identifier -ea 0
If any output is returned from the above line - its blocked.

Unblock a custom module
ls -r | unblock-file

Pscap requires VC Runtime 2013 - x86 or x64

and also this solution requires Network monitor V 3.4 - which provides a command line packet capture interface.

Finally I wrote some event logging code as well so a custom event source has to be registered called JRiver-monitoring which is a one liner.

New-EventLog –LogName Application –Source "JRiver-monitoring"

===================



Works for my needs.
Logged

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392

Cool code.

Hopefully if bob is looking at this thread, he may be motivated to have MC send M-SEARCH requests more frequently; perhaps specifically and repeatedly when MC has detected once that a device was present, and appears now not to be present; perhaps keep searching for a day or two before finally giving up the search...

Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm
Pages: [1]   Go Up