in

andy vt's tools & blog

automating lazy

This Blog

Syndication

andy vt's blog

MSAS Bug?

There's a bug in LCDWriter where the name of the TV show that you're watching doesn't display if you've watched a show in the same series immediately before, and deleted the previous show before watching the show that has the problem.  This bug has been around for as long as there's been a LCDWriter, I've just never taken the time to understand why it occurs.  I finally got sick of seeing "Recorded TV" while watching a series of shows, and took a look into it.

Starting with a basic explanation of  how MSAS (Media State Aggregation Service) works; if you're familiar with how you can skip this part. 

MSAS requires that two interfaces are implemented in a sink.

public interface IMediaStatusSink { void Initialize(); IMediaStatusSession CreateSession(); } public interface IMediaStatusSession { void MediaStatusChange(MEDIASTATUSPROPERTYTAG[] Tags, object[] Properties); void Close(); }

IMediaStatusSink on the main class, and IMediaStatusSession on the individual sessions (appropriately an IMediaStatusSession is the collection of status values for a media session; show name, current position, etc).  When ehmsas.exe (the exe that does all the MSAS lifting) starts up (usually when a user logs in) it calls Initialize on the the class that implements IMediaStatusSink, so it can start up the VFD (or whatever the output medium is).  When Media Center starts ehmsas calls CreateSession for each new session that starts up; in this method the class creates an instance of the class that implements IMediaStatusSession and passes it back to ehmsas so it can have a reference when it needs to update media status.

Every time a status property changes ehmsas calls MediaStatusChange with the new property value.  It's important to note that sessions are shared for each media type (i.e. watching a couple shows in a row all use the same session), and only new or changed values are passed, ehmsas does not empty properties that were sent previously.  When a session is complete; i.e. a new media session is started (playing a video after watching a TV show), or the current item is deleted Close is called on the session.

This is where the problem comes in.  When watching several shows in the same series, they generally share several properties; things like title, duration, etc.  Ehmsas calls Close when the show is deleted, then calls CreateSession when playback starts on the next show, but assumes that the shared properties are still there in the session and never passes them so the new session only has the current playback position.

Once this behavior is observed it's relatively easy to workaround the issue by storing session data when Close is called and using it to prepopulate new sessions of the same type when they are created, but that stinks of a bug to me.

The new version of LCDWriter can be downloaded here.

Comments

No Comments
@2008 andy vt
Powered by Community Server (Non-Commercial Edition), by Telligent Systems