[webkit-changes] [WebKit/WebKit] 46b462: [ macOS ] 2 http/tests/media/FairPlay tests are br...

Jer Noble noreply at github.com
Fri Jun 16 11:22:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 46b462205dd97be0f9eaa729085860c288436be1
      https://github.com/WebKit/WebKit/commit/46b462205dd97be0f9eaa729085860c288436be1
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-06-16 (Fri, 16 Jun 2023)

  Changed paths:
    M LayoutTests/http/tests/media/fairplay/legacy-fairplay-hls.html
    M LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v2.html
    M LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v3.html
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/Modules/mediasource/MediaSource.cpp
    M Source/WebCore/Modules/mediasource/MediaSource.h
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
    M Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.h
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.h
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.messages.in
    M Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp
    M Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDMFactory.h
    M Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDMSession.cpp

  Log Message:
  -----------
  [ macOS ] 2 http/tests/media/FairPlay tests are broken.
https://bugs.webkit.org/show_bug.cgi?id=255294
rdar://107891205

Reviewed by Ryosuke Niwa.

Fixing 4 related issues which keep these tests from passing consistentely:

1. When adding a MediaSource to a HTMLMediaElement via the element's .srcObject
   property, sometimes the MediaSource wrapper will be collected before the element
   has fully attached, and before the "sourceopen" event is fired. Mitigate this
   by returning true from virtualHasPendingActivity() in the time between when
   the MediaSource is set as srcObject and when it fires the "sourceopen" event.

2. HTMLMediaElement's own virtualHasPendingActivity() method will check whether
   the element is in the "ended" state. To do so, it calls m_player->duration(),
   which in the case of MediaSource, makes a call through a WeakPtr back up to
   the MediaSource to return _its_ duration. However, virtualHasPendingActivity()
   will be called on a background thread, and the WeakPtr accessor will throw
   an assertion. Rather than bounce down to MediaPlayer and back up to MediaSource,
   just query MediaSource directly.

   This will address the narrow issue of duration(), but the rest of the calls
   in virtualHasPendingActivity() may be non-thread-safe and further investigation
   and analysis is warranted.

3. Sometimes tests would fail with "decode" errors if ran back-to-back. One
   cause may be that CDM proxy objects in the GPU process are not consistently
   destroyed when their objects in the WebContent process are destroyed. Fix the
   RemoteLegacyCDMFactory to keep a WeakPtr map of CDM objects, and to track as
   those objects are created and destroyed, sending a message to the GPU process
   for its proxy to remove proxy objects.

   When the GPUConnectionToWebProcess closes, explicitly clear both the
   RemoteLegacyCDMFactory and RemoteCDMFactory objects, rather than wait for the
   connections refcount to go to zero.

   When destroying the CDMSessionAVContentKeySession, explicitly flush all
   attached SourceBufferPrivate objects, as well as removing the parser from
   the AVContentKeySession. Also explicitly expire the session before releasing
   it.

   This should cause system resources dedicated to protected playback to be more
   consistently freed after a test ends.

4. Add an explicit handler in the legacy tests which will fail the test (rather than
   time out) if the video throws an error. This will make the tests complete faster
   when video decoding fails, generating failed tests rather than time out results.

* LayoutTests/http/tests/media/fairplay/legacy-fairplay-hls.html:
* LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v2.html:
* LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v3.html:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setAsSrcObject):
(WebCore::MediaSource::virtualHasPendingActivity const):
(WebCore::MediaSource::onReadyStateChange):
* Source/WebCore/Modules/mediasource/MediaSource.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setSrcObject):
(WebCore::HTMLMediaElement::durationMediaTime const):
(WebCore::HTMLMediaElement::detachMediaSource):
* Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::~CDMSessionAVContentKeySession):
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::didClose):
* Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:
(WebKit::RemoteCDMFactoryProxy::~RemoteCDMFactoryProxy):
(WebKit::RemoteCDMFactoryProxy::clear):
* Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.h:
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp:
(WebKit::RemoteLegacyCDMFactoryProxy::~RemoteLegacyCDMFactoryProxy):
(WebKit::RemoteLegacyCDMFactoryProxy::clear):
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.h:
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.messages.in:
* Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp:
(WebKit::RemoteLegacyCDMFactory::addSession):
(WebKit::RemoteLegacyCDMFactory::removeSession):
(WebKit::RemoteLegacyCDMFactory::didReceiveSessionMessage): Deleted.
* Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDMFactory.h:
* Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDMSession.cpp:
(WebKit::RemoteLegacyCDMSession::create):
(WebKit::RemoteLegacyCDMSession::~RemoteLegacyCDMSession):

Canonical link: https://commits.webkit.org/265252@main




More information about the webkit-changes mailing list