Skip to content

Commit bbe2249

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 This fixes #1585.
1 parent 3c84c7a commit bbe2249

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
@@ -546,10 +546,10 @@ void CDMInstanceSessionThunder::requestLicense(LicenseType licenseType, const At
546546
m_challengeCallbacks.append(WTFMove(generateChallenge));
547547
}
548548

549-
void CDMInstanceSessionThunder::sessionFailure()
549+
void CDMInstanceSessionThunder::sessionChanged(SessionChangedResult result)
550550
{
551551
for (auto& sessionChangedCallback : m_sessionChangedCallbacks)
552-
sessionChangedCallback(false, nullptr);
552+
sessionChangedCallback(result == SessionChangedResult::Success, nullptr);
553553
m_sessionChangedCallbacks.clear();
554554
}
555555

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

597597
void CDMInstanceSessionThunder::loadSession(LicenseType, const String& sessionID, const String&, LoadSessionCallback&& callback)
@@ -636,7 +636,7 @@ void CDMInstanceSessionThunder::loadSession(LicenseType, const String& sessionID
636636
});
637637
if (!m_session || m_sessionID.isEmpty() || opencdm_session_load(m_session->get())) {
638638
GST_DEBUG("loading failed");
639-
sessionFailure();
639+
sessionChanged(SessionChangedResult::Failure);
640640
}
641641
}
642642

@@ -684,7 +684,14 @@ void CDMInstanceSessionThunder::removeSessionData(const String& sessionID, Licen
684684
}
685685
});
686686
if (!m_session || m_sessionID.isEmpty() || opencdm_session_remove(m_session->get()))
687-
sessionFailure();
687+
sessionChanged(SessionChangedResult::Failure);
688+
else
689+
sessionChanged(SessionChangedResult::Success);
690+
m_session = BoxPtr<OpenCDMSession>();
691+
auto instance = cdmInstanceThunder();
692+
if (instance)
693+
instance->unrefAllKeysFrom(m_keyStore);
694+
m_keyStore.clear();
688695
}
689696

690697
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
@@ -150,7 +150,12 @@ class CDMInstanceSessionThunder final : public CDMInstanceSessionProxy {
150150
void keysUpdateDoneCallback();
151151
void errorCallback(RefPtr<SharedBuffer>&&);
152152
CDMInstanceSession::KeyStatus status(const KeyIDType&) const;
153-
void sessionFailure();
153+
154+
enum class SessionChangedResult : bool {
155+
Failure,
156+
Success
157+
};
158+
void sessionChanged(SessionChangedResult);
154159

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

0 commit comments

Comments
 (0)