[mythtv-commits] Ticket #3392: Fix asFileNotFound handling for remote files and storage groups

MythTV mythtv at cvs.mythtv.org
Wed May 2 00:50:00 UTC 2007

#3392: Fix asFileNotFound handling for remote files and storage groups
 Reporter:  sphery <mtdean at thirdcontact.com>  |       Owner:  ijr    
     Type:  patch                             |      Status:  new    
 Priority:  minor                             |   Milestone:  unknown
Component:  mythtv                            |     Version:  head   
 Severity:  medium                            |  
 The introduction of Storage Groups created a minor bug in asFileNotFound
 handling in PlaybackBox.  Basically, there's a race between
 RemoteCheckFile() and ProgramInfo::GetPlaybackURL()--each of which changes
 the ProgramInfo's pathname--that may cause the FileNotFoundActionPopup to
 be shown for a file which is available for streaming from a backend if the
 file is not available locally.

 The Gory Details:

 The PlaybackBox::updateVideo() function calls PlaybackBox::fileExists() to
 determine whether a file is available before beginning to play the video
 preview.  Since fileExists() calls ProgramInfo::PathnameExists(), which
 calls RemoteCheckFile(), the ProgramInfo's pathname gets changed to the
 local pathname of the recording file, regardless of whether that local
 pathname is accessible on this host.  (This behavior of RemoteCheckFile()
 also caused the issue in #2763.)

 If the recording file is not available locally and
 PlaybackBox::showActions() is called after RemoteCheckFile() sets the path
 to the local path but before updateVideo() calls
 PlaybackBox::startPlayer(), showFileNotFoundActionPopup() will be called,
 even if the file is available for streaming.  If, however, updateVideo()
 calls startPlayer() before showActions() is called, startPlayer() will
 call ProgramInfo::GetPlaybackURL(), which will eventually determine that
 the file is not available locally and reset the pathname to a myth:// URL.
 (Note that showActions() can be accessed by hitting Right with
 UseArrowAccels enabled.)

 If the pathname is a myth:// URL, calls to PathnameExists() result in
 RemoteCheckFile(), being called, so the real available status will be
 determined (although this call will also cause the pathname to be
 changed).  Therefore, since PlaybackBox::updateVideo() calls
 PlaybackBox::fileExists(), which calls ProgramInfo::PathnameExists(), if
 the pathname is set to a not-available-to-this-host local pathname at the
 time showActions() is called, the FileNotFoundActionPopup is shown.  If,
 instead, the pathname is set to a myth:// URL, showActions() will
 correctly show the ActionPopup.

 Because of the keep-trying design of updateVideo(), once the user
 dismisses the FileNotFoundActionPopup, the preview will begin playing
 normally.  However, even while the preview video is playing, the user will
 be unable to play the recording using right or P buttons because the
 ProgramInfo's availableStatus has been set to asFileNotFound.

 A very patient user with preview videos enabled is unlikely to see this
 issue as there's only a small amount of time (about 2 seconds with HDTV
 and less with SDTV) between the call to RemoteCheckFile() and
 GetPlaybackURL().  Also, users who do not trigger the showActions()
 function (i.e. by just hitting the P button to play the recording) will
 not see the issue.  However, anyone who hits right twice from the left
 column of the PlaybackBox will likely trigger the bug.  Upon doing so,
 they must exit and re-enter the Watch Recordings screen to get another
 chance (and are likely to be very confused when the preview plays but Myth
 says the file doesn't exist).

 The asFileNotFound handling issue exists regardless of the
 AlwaysStreamFiles and MasterBackendOverride settings as RemoteCheckFile()
 will still overwrite the pathname with a local (unavailable) path.

 Therefore, I think the proper fix for this is to prevent the pathname from
 being changed to the local pathname when the file is not available
 locally.  The attached patch takes this approach.  If there is a reason
 for the pathname to be changed to the not-available-to-this-host local
 path of the file, please let me know.  I had taken two other approaches to
 fixing this issue (so I could easily recreate those patches), but this one
 seemed to be the most appropriate fix as it always prevents the pathname
 from being set to an unavailable local path rather than fixing only

 For reference, I have 2 dedicated backends and one remote frontend.  Each
 backend has its own storage and I am not using any network filesystems to
 share files.

Ticket URL: <http://svn.mythtv.org/trac/ticket/3392>
MythTV <http://svn.mythtv.org/trac>

More information about the mythtv-commits mailing list