Skip to content

Commit aa01883

Browse files
committed
[EME][GStreamer][Thunder] Complete removeSessionData implementation
https://bugs.webkit.org/show_bug.cgi?id=303463 Reviewed by Philippe Normand. We were missing to clear up the session and update and clear the keys. Original patch by Santhosh-Kumar-infosys <[email protected]>. * Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp: (WebCore::CDMInstanceSessionThunder::sessionChanged): (WebCore::CDMInstanceSessionThunder::updateLicense): (WebCore::CDMInstanceSessionThunder::loadSession): (WebCore::CDMInstanceSessionThunder::removeSessionData): (WebCore::CDMInstanceSessionThunder::sessionFailure): Deleted. * Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h: Canonical link: https://commits.webkit.org/303826@main
1 parent 6654770 commit aa01883

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,10 @@ void CDMInstanceSessionThunder::requestLicense(LicenseType licenseType, KeyGroup
545545
m_challengeCallbacks.append(WTFMove(generateChallenge));
546546
}
547547

548-
void CDMInstanceSessionThunder::sessionFailure()
548+
void CDMInstanceSessionThunder::sessionChanged(SessionChangedResult result)
549549
{
550550
for (auto& sessionChangedCallback : m_sessionChangedCallbacks)
551-
sessionChangedCallback(false, nullptr);
551+
sessionChangedCallback(result == SessionChangedResult::Success, nullptr);
552552
m_sessionChangedCallbacks.clear();
553553
}
554554

@@ -590,7 +590,7 @@ void CDMInstanceSessionThunder::updateLicense(const String& sessionID, LicenseTy
590590
});
591591
auto responseData = response->extractData();
592592
if (!m_session || m_sessionID.isEmpty() || opencdm_session_update(m_session->get(), responseData.data(), responseData.size()))
593-
sessionFailure();
593+
sessionChanged(SessionChangedResult::Failure);
594594
}
595595

596596
void CDMInstanceSessionThunder::loadSession(LicenseType, const String& sessionID, const String&, LoadSessionCallback&& callback)
@@ -634,7 +634,7 @@ void CDMInstanceSessionThunder::loadSession(LicenseType, const String& sessionID
634634
}
635635
});
636636
if (!m_session || m_sessionID.isEmpty() || opencdm_session_load(m_session->get()))
637-
sessionFailure();
637+
sessionChanged(SessionChangedResult::Failure);
638638
}
639639

640640
void CDMInstanceSessionThunder::closeSession(const String& sessionID, CloseSessionCallback&& callback)
@@ -681,7 +681,14 @@ void CDMInstanceSessionThunder::removeSessionData(const String& sessionID, Licen
681681
}
682682
});
683683
if (!m_session || m_sessionID.isEmpty() || opencdm_session_remove(m_session->get()))
684-
sessionFailure();
684+
sessionChanged(SessionChangedResult::Failure);
685+
else
686+
sessionChanged(SessionChangedResult::Success);
687+
m_session = BoxPtr<OpenCDMSession>();
688+
auto instance = cdmInstanceThunder();
689+
if (instance)
690+
instance->unrefAllKeysFrom(m_keyStore);
691+
m_keyStore.clear();
685692
}
686693

687694
void CDMInstanceSessionThunder::storeRecordOfKeyUsage(const String&)

Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ class CDMInstanceSessionThunder final : public CDMInstanceSessionProxy {
151151
void keysUpdateDoneCallback();
152152
void errorCallback(RefPtr<SharedBuffer>&&);
153153
CDMInstanceSession::KeyStatus status(const KeyIDType&) const;
154-
void sessionFailure();
154+
155+
enum class SessionChangedResult : bool {
156+
Failure,
157+
Success
158+
};
159+
void sessionChanged(SessionChangedResult);
155160

156161
// FIXME: Check all original uses of these attributes.
157162
String m_sessionID;

0 commit comments

Comments
 (0)