Changeset 207884 in webkit
- Timestamp:
- Oct 26, 2016 1:44:04 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207883 r207884 1 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> 2 3 [GStreamer][EME] Add EME support to base private player 4 https://bugs.webkit.org/show_bug.cgi?id=162908 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Add encryption key management support. 9 10 This patch is authored by Philippe Normand <philn@igalia.com>. 11 12 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 13 (WebCore::registerWebKitGStreamerElements): 14 (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): 15 (WebCore::MediaPlayerPrivateGStreamerBase::needKey): 16 (WebCore::MediaPlayerPrivateGStreamerBase::setCDMSession): 17 (WebCore::MediaPlayerPrivateGStreamerBase::keyAdded): 18 (WebCore::MediaPlayerPrivateGStreamerBase::createSession): 19 (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey): 20 (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem): 21 (WebCore::MediaPlayerPrivateGStreamerBase::extendedSupportsType): 22 (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Deleted. 23 (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): Deleted. 24 (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Deleted. 25 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 26 (WebCore::MediaPlayerPrivateGStreamerBase::pipeline): 27 1 28 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> 2 29 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r207874 r207884 4 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 5 5 * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org> 6 * Copyright (C) 2009, 2010 Igalia S.L 6 * Copyright (C) 2009, 2010, 2015, 2016 Igalia S.L 7 * Copyright (C) 2015, 2016 Metrological Group B.V. 7 8 * 8 9 * This library is free software; you can redistribute it and/or … … 91 92 #endif 92 93 94 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 95 #include "UUID.h" 96 #include "WebKitClearKeyDecryptorGStreamer.h" 97 #include <runtime/JSCInlines.h> 98 #include <runtime/TypedArrayInlines.h> 99 #include <runtime/Uint8Array.h> 100 #endif 101 93 102 GST_DEBUG_CATEGORY(webkit_media_player_debug); 94 103 #define GST_CAT_DEFAULT webkit_media_player_debug … … 97 106 98 107 namespace WebCore { 108 109 void registerWebKitGStreamerElements() 110 { 111 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 112 if (!webkitGstCheckVersion(1, 6, 1)) 113 return; 114 115 GRefPtr<GstElementFactory> clearKeyDecryptorFactory = gst_element_factory_find("webkitclearkey"); 116 if (!clearKeyDecryptorFactory) 117 gst_element_register(nullptr, "webkitclearkey", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_MEDIA_CK_DECRYPT); 118 #endif 119 } 99 120 100 121 static int greatestCommonDivisor(int a, int b) … … 221 242 bool MediaPlayerPrivateGStreamerBase::handleSyncMessage(GstMessage* message) 222 243 { 244 UNUSED_PARAM(message); 223 245 #if USE(GSTREAMER_GL) 224 246 if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_NEED_CONTEXT) … … 237 259 UNUSED_PARAM(message); 238 260 #endif // USE(GSTREAMER_GL) 261 262 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 263 if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) { 264 const GstStructure* structure = gst_message_get_structure(message); 265 if (gst_structure_has_name(structure, "drm-key-needed")) { 266 GST_DEBUG("handling drm-key-needed message"); 267 268 // Here we receive the DRM init data from the pipeline: we will emit 269 // the needkey event with that data and the browser might create a 270 // CDMSession from this event handler. If such a session was created 271 // We will emit the message event from the session to provide the 272 // DRM challenge to the browser and wait for an update. If on the 273 // contrary no session was created we won't wait and let the pipeline 274 // error out by itself. 275 GRefPtr<GstBuffer> data; 276 GUniqueOutPtr<gchar> keySystemId; 277 gboolean valid = gst_structure_get(structure, "data", GST_TYPE_BUFFER, &data.outPtr(), 278 "key-system-id", G_TYPE_STRING, &keySystemId.outPtr(), nullptr); 279 GstMapInfo mapInfo; 280 if (UNLIKELY(!valid || !gst_buffer_map(data.get(), &mapInfo, GST_MAP_READ))) 281 return false; 282 283 GST_DEBUG("scheduling keyNeeded event"); 284 // FIXME: Provide a somehow valid sessionId. 285 RefPtr<Uint8Array> initData = Uint8Array::create(reinterpret_cast<const unsigned char *>(mapInfo.data), mapInfo.size); 286 needKey(initData); 287 gst_buffer_unmap(data.get(), &mapInfo); 288 return true; 289 } 290 } 291 #endif // ENABLE(LEGACY_ENCRYPTED_MEDIA) 239 292 240 293 return false; … … 1071 1124 } 1072 1125 1126 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 1127 void MediaPlayerPrivateGStreamerBase::needKey(RefPtr<Uint8Array> initData) 1128 { 1129 if (!m_player->keyNeeded(initData.get())) 1130 GST_INFO("no event handler for key needed"); 1131 } 1132 1133 void MediaPlayerPrivateGStreamerBase::setCDMSession(CDMSession* session) 1134 { 1135 GST_DEBUG("setting CDM session to %p", session); 1136 m_cdmSession = session; 1137 } 1138 1139 void MediaPlayerPrivateGStreamerBase::keyAdded() 1140 { 1141 } 1142 1143 std::unique_ptr<CDMSession> MediaPlayerPrivateGStreamerBase::createSession(const String& keySystem, CDMSessionClient*) 1144 { 1145 GST_INFO("Requested CDMSession for KeySystem %s: Returning null.", keySystem.utf8().data()); 1146 return nullptr; 1147 } 1148 1149 void MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey(GstBuffer* buffer) 1150 { 1151 gst_element_send_event(m_pipeline.get(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, 1152 gst_structure_new("drm-cipher", "key", GST_TYPE_BUFFER, buffer, nullptr))); 1153 } 1154 #endif 1155 1156 bool MediaPlayerPrivateGStreamerBase::supportsKeySystem(const String& keySystem, const String& mimeType) 1157 { 1158 GST_INFO("Checking for KeySystem support with %s and type %s: false.", keySystem.utf8().data(), mimeType.utf8().data()); 1159 return false; 1160 } 1161 1162 MediaPlayer::SupportsType MediaPlayerPrivateGStreamerBase::extendedSupportsType(const MediaEngineSupportParameters& parameters, MediaPlayer::SupportsType result) 1163 { 1164 UNUSED_PARAM(parameters); 1165 return result; 1166 } 1167 1073 1168 } 1074 1169 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r207874 r207884 3 3 * Copyright (C) 2007 Collabora Ltd. All rights reserved. 4 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2009, 2010 Igalia S.L 5 * Copyright (C) 2009, 2010, 2015, 2016 Igalia S.L 6 * Copyright (C) 2015, 2016 Metrological Group B.V. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 55 56 class VideoTextureCopierGStreamer; 56 57 58 void registerWebKitGStreamerElements(); 59 57 60 class MediaPlayerPrivateGStreamerBase : public MediaPlayerPrivateInterface 58 61 #if USE(COORDINATED_GRAPHICS_THREADED) || (USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)) … … 119 122 #endif 120 123 124 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 125 void needKey(RefPtr<Uint8Array>); 126 void setCDMSession(CDMSession*); 127 void keyAdded(); 128 virtual void dispatchDecryptionKey(GstBuffer*); 129 #endif 130 131 static bool supportsKeySystem(const String& keySystem, const String& mimeType); 132 static MediaPlayer::SupportsType extendedSupportsType(const MediaEngineSupportParameters&, MediaPlayer::SupportsType); 133 121 134 #if USE(GSTREAMER_GL) 122 135 bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject, GC3Denum, GC3Dint, GC3Denum, GC3Denum, GC3Denum, bool, bool) override; … … 125 138 126 139 void setVideoSourceOrientation(const ImageOrientation&); 140 GstElement* pipeline() const { return m_pipeline.get(); } 127 141 128 142 protected: … … 184 198 GRefPtr<GstElement> m_fpsSink; 185 199 MediaPlayer::ReadyState m_readyState; 186 MediaPlayer::NetworkState m_networkState;200 mutable MediaPlayer::NetworkState m_networkState; 187 201 IntSize m_size; 188 202 mutable GMutex m_sampleMutex; … … 215 229 216 230 ImageOrientation m_videoSourceOrientation; 217 231 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 232 std::unique_ptr<CDMSession> createSession(const String&, CDMSessionClient*); 233 CDMSession* m_cdmSession; 234 #endif 218 235 #if USE(GSTREAMER_GL) 219 236 std::unique_ptr<VideoTextureCopierGStreamer> m_videoTextureCopier; 220 237 #endif 221 238 }; 239 222 240 } 223 241
Note: See TracChangeset
for help on using the changeset viewer.