[Mac] Inactive AirPlay route should automatically timeout
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jul 2015 18:04:10 +0000 (18:04 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jul 2015 18:04:10 +0000 (18:04 +0000)
commit180cb5ad7dd7cd652d922a4ab162244b02efb46b
treee937363305d795370cda16c83100e6fe947cf7ee
parentadf7300a735b79391513c6b44625c4adbbc4798b
[Mac] Inactive AirPlay route should automatically timeout
https://bugs.webkit.org/show_bug.cgi?id=146642
<rdar://problem/21602955>

Automatically clear a media element's AirPlay connection after it has been paused
for 60 minutes, or after 8 minutes if it played to the end before pausing.

Reviewed by Brent Fulgham.

* Modules/mediasession/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::WebMediaSessionManager): Initialize m_watchdogTimer.
(WebCore::WebMediaSessionManager::clientStateDidChange): Schedule watchdog timer configuration
  if the client started playing or paused.
(WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Schedule watchdog timer configuration.
(WebCore::WebMediaSessionManager::toString): Print watchdog configuration flag.
(WebCore::WebMediaSessionManager::taskTimerFired): Call configureWatchdogTimer.
(WebCore::WebMediaSessionManager::configureWatchdogTimer): New, start or stop watchdog timer.
(WebCore::WebMediaSessionManager::watchdogTimerFired): Stop monitoring for targets, which
  clears the route.
* Modules/mediasession/WebMediaSessionManager.h:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaState): Set DidPlayToEnd when appropriate.

* page/MediaProducer.h: Add DidPlayToEnd.

* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
(WebCore::MediaPlaybackTargetPickerMac::~MediaPlaybackTargetPickerMac): Clear m_client, call
  stopMonitoringPlaybackTargets.
(WebCore::MediaPlaybackTargetPickerMac::pendingActionTimerFired): Send a neutered
  MediaPlaybackTarget when m_outputDeviceMenuController is NULL.
(WebCore::MediaPlaybackTargetPickerMac::devicePicker): Add logging.
(WebCore::MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets): Clear the menu
  controller to cancel the route.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp
Source/WebCore/Modules/mediasession/WebMediaSessionManager.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/page/MediaProducer.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm