Changeset 231699 in webkit
- Timestamp:
- May 11, 2018 3:50:37 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231696 r231699 1 2018-05-11 Yacine Bandou <yacine.bandou_ext@softathome.com> 2 3 [EME][GStreamer] Handle the protection event in MediaPlayerPrivate 4 https://bugs.webkit.org/show_bug.cgi?id=185535 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 This patch is based on this calvaris's commit 9 https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d966168b0d2b65f9ca9415426e26d3752c78b03e 10 11 It adds a handler for the protection event in MediaPalyerPrivateGStreamerBase, it extracts the InitData from the event 12 and sends the encrypted event to JS via HTMLMediaElement. 13 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 14 (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): 15 (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): 16 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 17 * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Add a new type InitData. 18 1 19 2018-05-11 Basuke Suzuki <Basuke.Suzuki@sony.com> 2 20 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r231551 r231699 1205 1205 1206 1206 #if ENABLE(ENCRYPTED_MEDIA) 1207 void MediaPlayerPrivateGStreamerBase::initializationDataEncountered(GstEvent* event) 1208 { 1209 // FIXME: Inform that we are waiting for a key. 1210 const char* eventKeySystemUUID = nullptr; 1211 GstBuffer* data = nullptr; 1212 gst_event_parse_protection(event, &eventKeySystemUUID, &data, nullptr); 1213 1214 // Check if the system key of the protection event is the same of the CDM instance. 1215 // For example: we can receive a new Widevine protection event but the CDM instance initialized with 1216 // Playready, so we ignore this event. 1217 if (m_cdmInstance && g_strcmp0(GStreamerEMEUtilities::keySystemToUuid(m_cdmInstance->keySystem()), eventKeySystemUUID)) { 1218 GST_DEBUG("The protection event with UUID %s is ignored because it isn't supported by the CDM %s", eventKeySystemUUID, m_cdmInstance->keySystem().utf8().data()); 1219 return; 1220 } 1221 1222 GstMapInfo mapInfo; 1223 if (!gst_buffer_map(data, &mapInfo, GST_MAP_READ)) { 1224 GST_WARNING("cannot map %s protection data", eventKeySystemUUID); 1225 return; 1226 } 1227 1228 GST_TRACE("init data encountered for %s of size %" G_GSIZE_FORMAT, eventKeySystemUUID, mapInfo.size); 1229 GST_MEMDUMP("init data", reinterpret_cast<const uint8_t*>(mapInfo.data), mapInfo.size); 1230 InitData initData(reinterpret_cast<const uint8_t*>(mapInfo.data), mapInfo.size); 1231 gst_buffer_unmap(data, &mapInfo); 1232 1233 String eventKeySystemUUIDString = eventKeySystemUUID; 1234 RunLoop::main().dispatch([weakThis = m_weakPtrFactory.createWeakPtr(*this), eventKeySystemUUID = eventKeySystemUUIDString, initData] { 1235 if (!weakThis) 1236 return; 1237 1238 GST_DEBUG("scheduling initializationDataEncountered event for %s with init data size of %" G_GSIZE_FORMAT, eventKeySystemUUID.utf8().data(), initData.sizeInBytes()); 1239 GST_MEMDUMP("init datas", reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes()); 1240 weakThis->m_player->initializationDataEncountered(ASCIILiteral("cenc"), ArrayBuffer::create(reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes())); 1241 }); 1242 } 1243 1207 1244 void MediaPlayerPrivateGStreamerBase::cdmInstanceAttached(CDMInstance& instance) 1208 1245 { … … 1257 1294 if (m_handledProtectionEvents.contains(GST_EVENT_SEQNUM(event))) { 1258 1295 GST_DEBUG_OBJECT(pipeline(), "event %u already handled", GST_EVENT_SEQNUM(event)); 1259 m_handledProtectionEvents.remove(GST_EVENT_SEQNUM(event)); 1260 if (m_needToResendCredentials) { 1261 GST_DEBUG_OBJECT(pipeline(), "resending credentials"); 1262 attemptToDecryptWithLocalInstance(); 1263 } 1264 return; 1265 } 1266 1267 const gchar* eventKeySystemId = nullptr; 1268 gst_event_parse_protection(event, &eventKeySystemId, nullptr, nullptr); 1269 GST_WARNING("FIXME: unhandled protection event for %s", eventKeySystemId); 1270 ASSERT_NOT_REACHED(); 1296 return; 1297 } 1298 initializationDataEncountered(event); 1271 1299 } 1272 1300 #endif -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r231088 r231699 145 145 void attemptToDecryptWithInstance(CDMInstance&) override; 146 146 void dispatchCDMInstance(); 147 void initializationDataEncountered(GstEvent*); 147 148 #endif 148 149 -
trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h
r230625 r231699 32 32 namespace WebCore { 33 33 34 using InitData = String; 35 34 36 class GStreamerEMEUtilities { 35 37
Note: See TracChangeset
for help on using the changeset viewer.