Skip to content

Commit

Permalink
[Cocoa] sampleBufferContentKeySessionSupportEnabled: Not enqueueing f…
Browse files Browse the repository at this point in the history
…rames during "pending" key state means key state never progresses beyond "pending"

https://bugs.webkit.org/show_bug.cgi?id=266284
rdar://119557042

Reviewed by Eric Carlson.

When the state of the AVContentKeyRequest/AVContentKey is "pending", the AVContentKeySession
is waiting to be connected with an AVSampleBufferDisplayLayer before updating that state to
"usable" or "restricted". The API contract when the sampleBufferContentKeySessionSupportEnabled
path is enabled is that the client will not enqueue samples for display unless it knows there
is a usable key for that sample. However, due to this behavior, the request/key is stuck in
the "pending" state.

Work around this behavior by still enqueueing samples when in the "pending" state, and in fact,
only block enqueueing samples when the key is in a known-failed state.

* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::isAnyKeyUsable const):

Canonical link: https://commits.webkit.org/271944@main
  • Loading branch information
jernoble committed Dec 12, 2023
1 parent 13f0d24 commit b8180b2
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,19 @@ void fail()
continue;

for (auto& keyStatusPair : sessionInterface->keyStatuses()) {
if (keyStatusPair.second != CDMInstanceSession::KeyStatus::Usable)
switch (keyStatusPair.second) {
case CDMInstanceSession::KeyStatus::Expired:
case CDMInstanceSession::KeyStatus::Released:
case CDMInstanceSession::KeyStatus::InternalError:
// Key is unusable.
continue;
case CDMInstanceSession::KeyStatus::Usable:
case CDMInstanceSession::KeyStatus::OutputRestricted:
case CDMInstanceSession::KeyStatus::OutputDownscaled:
case CDMInstanceSession::KeyStatus::StatusPending:
// Key is (potentially) usable.
break;
}

if (keys.findIf([&] (auto& key) {
return key.get() == keyStatusPair.first.get();
Expand Down

0 comments on commit b8180b2

Please sign in to comment.