[webkit-changes] [WebKit/WebKit] d7336d: [EME] Blocked encrypted samples are not enqueued a...

aestes noreply at github.com
Mon Jan 22 18:40:43 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d7336d4f5da69f80f35c36f8083e53d3c6217dda
      https://github.com/WebKit/WebKit/commit/d7336d4f5da69f80f35c36f8083e53d3c6217dda
  Author: Andy Estes <aestes at apple.com>
  Date:   2024-01-22 (Mon, 22 Jan 2024)

  Changed paths:
    M LayoutTests/http/tests/media/fairplay/eme2016.js
    A LayoutTests/http/tests/media/fairplay/fps-mse-attach-cdm-after-key-exchange-expected.txt
    A LayoutTests/http/tests/media/fairplay/fps-mse-attach-cdm-after-key-exchange.html
    M LayoutTests/http/tests/media/fairplay/fps-mse-play-while-not-in-dom.html
    M LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-audio-only.html
    M LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-key-renewal.html
    M LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-key-rotation.html
    M LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-multiple-keys.html
    M LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-same-key.html
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm
    M Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

  Log Message:
  -----------
  [EME] Blocked encrypted samples are not enqueued after a CDM is attached to a SourceBuffer (affects netflix.com)
https://bugs.webkit.org/show_bug.cgi?id=267804
rdar://120879185

Reviewed by Jean-Yves Avenard and Jer Noble.

When SourceBuffer attempts to enqueue an encrypted sample before either a CDM is attached or a
usable key is present it adds the sample to a list of "blocked" samples. The intention was to later
enqueue these samples once a CDM was attached and usable keys were present, however this would
never occur for two reasons:

1. While SourceBufferPrivateAVFObjC had a key status observer that would enqueue blocked samples
when called, it was never added to the attached CDM and therefore never called.
2. Even if the observer were added, if key status resolved to a terminal state prior to the CDM
being attached then the observer would never be called.

These issues manifested in sporadic playback failures on netflix.com (and possibly other EME sites).

Addressed (1) by adding SourceBufferPrivateAVFObjC's key status observer to the attached CDM.
Addressed (2) by attempting to enqueue blocked samples immediately at CDM attachment time.

Added a layout test.

* LayoutTests/http/tests/media/fairplay/eme2016.js:
(async startEME):
(async fetchAppendAndWaitForEncrypted):
(async createBufferAppendAndWaitForEncrypted):
* LayoutTests/http/tests/media/fairplay/fps-mse-attach-cdm-after-key-exchange-expected.txt: Added.
* LayoutTests/http/tests/media/fairplay/fps-mse-attach-cdm-after-key-exchange.html: Copied from LayoutTests/http/tests/media/fairplay/fps-mse-play-while-not-in-dom.html.
* LayoutTests/http/tests/media/fairplay/fps-mse-play-while-not-in-dom.html:
* LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-audio-only.html:
* LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-key-renewal.html:
* LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-key-rotation.html:
* LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-multiple-keys.html:
* LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-same-key.html:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enterFullscreen):
* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::addKeyStatusesChangedObserver):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeKeyStatusesChangedObserver):
* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
(WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt):
(WebCore::SourceBufferPrivateAVFObjC::tryToEnqueueBlockedSamples):
(WebCore::SourceBufferPrivateAVFObjC::keyStatusesChanged): Renamed to tryToEnqueueBlockedSamples.

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




More information about the webkit-changes mailing list