Changeset 231091 in webkit
- Timestamp:
- Apr 27, 2018 3:07:58 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231089 r231091 1 2018-04-27 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r231089. 4 https://bugs.webkit.org/show_bug.cgi?id=185071 5 6 Broke and made crash some WPE EME tests (Requested by calvaris 7 on #webkit). 8 9 Reverted changeset: 10 11 "[EME][GStreamer] Move the decryptor from AppendPipeline to 12 PlaybackPipeline." 13 https://bugs.webkit.org/show_bug.cgi?id=181855 14 https://trac.webkit.org/changeset/231089 15 1 16 2018-04-27 Yacine Bandou <yacine.bandou_ext@softathome.com> 2 17 -
trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp
r231089 r231091 300 300 301 301 switch (GST_EVENT_TYPE(event)) { 302 case GST_EVENT_PROTECTION: { 303 const char* systemId = nullptr; 304 305 gst_event_parse_protection(event, &systemId, nullptr, nullptr); 306 GST_TRACE_OBJECT(self, "received protection event for %s", systemId); 307 308 if (!g_strcmp0(systemId, klass->protectionSystemId)) { 309 GST_DEBUG_OBJECT(self, "sending protection event to the pipeline"); 310 gst_element_post_message(GST_ELEMENT(self), 311 gst_message_new_element(GST_OBJECT(self), 312 gst_structure_new("drm-key-needed", "event", GST_TYPE_EVENT, event, nullptr))); 313 } 314 315 gst_event_unref(event); 316 result = TRUE; 317 break; 318 } 302 319 case GST_EVENT_CUSTOM_DOWNSTREAM_OOB: { 303 320 if (klass->handleKeyResponse(self, event)) { -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
r231089 r231091 56 56 case AppendPipeline::AppendState::Ongoing: 57 57 return "Ongoing"; 58 case AppendPipeline::AppendState::KeyNegotiation: 59 return "KeyNegotiation"; 58 60 case AppendPipeline::AppendState::DataStarve: 59 61 return "DataStarve"; … … 91 93 appendPipeline->handleApplicationMessage(message); 92 94 } 95 96 #if ENABLE(ENCRYPTED_MEDIA) 97 static void appendPipelineElementMessageCallback(GstBus*, GstMessage* message, AppendPipeline* appendPipeline) 98 { 99 appendPipeline->handleElementMessage(message); 100 } 101 #endif 93 102 94 103 static void appendPipelineStateChangeMessageCallback(GstBus*, GstMessage* message, AppendPipeline* appendPipeline) … … 123 132 g_signal_connect(m_bus.get(), "sync-message::need-context", G_CALLBACK(appendPipelineNeedContextMessageCallback), this); 124 133 g_signal_connect(m_bus.get(), "message::application", G_CALLBACK(appendPipelineApplicationMessageCallback), this); 134 #if ENABLE(ENCRYPTED_MEDIA) 135 g_signal_connect(m_bus.get(), "message::element", G_CALLBACK(appendPipelineElementMessageCallback), this); 136 #endif 125 137 g_signal_connect(m_bus.get(), "message::state-changed", G_CALLBACK(appendPipelineStateChangeMessageCallback), this); 126 138 … … 264 276 gst_message_parse_context_type(message, &contextType); 265 277 GST_TRACE("context type: %s", contextType); 278 if (!g_strcmp0(contextType, "drm-preferred-decryption-system-id") 279 && m_appendState != AppendPipeline::AppendState::KeyNegotiation) 280 setAppendState(AppendPipeline::AppendState::KeyNegotiation); 266 281 267 282 // MediaPlayerPrivateGStreamerBase will take care of setting up encryption. … … 314 329 ASSERT_NOT_REACHED(); 315 330 } 331 332 #if ENABLE(ENCRYPTED_MEDIA) 333 void AppendPipeline::handleElementMessage(GstMessage* message) 334 { 335 ASSERT(WTF::isMainThread()); 336 337 const GstStructure* structure = gst_message_get_structure(message); 338 GST_TRACE("%s message from %s", gst_structure_get_name(structure), GST_MESSAGE_SRC_NAME(message)); 339 if (m_playerPrivate && gst_structure_has_name(structure, "drm-key-needed")) { 340 if (m_appendState != AppendPipeline::AppendState::KeyNegotiation) 341 setAppendState(AppendPipeline::AppendState::KeyNegotiation); 342 343 GST_DEBUG("sending drm-key-needed message from %s to the player", GST_MESSAGE_SRC_NAME(message)); 344 GRefPtr<GstEvent> event; 345 gst_structure_get(structure, "event", GST_TYPE_EVENT, &event.outPtr(), nullptr); 346 m_playerPrivate->handleProtectionEvent(event.get()); 347 } 348 } 349 #endif 316 350 317 351 void AppendPipeline::handleStateChangeMessage(GstMessage* message) … … 340 374 } 341 375 342 ASSERT(m_appendState == AppendState:: Ongoing || m_appendState == AppendState::Sampling);376 ASSERT(m_appendState == AppendState::KeyNegotiation || m_appendState == AppendState::Ongoing || m_appendState == AppendState::Sampling); 343 377 ASSERT(!m_appsrcNeedDataReceived); 344 378 … … 398 432 // | | `->Aborting-->NotStarted 399 433 // | `->Sampling-···->Sampling-->LastSample-->NotStarted 400 // | `->Aborting-->NotStarted 434 // | | `->Aborting-->NotStarted 435 // | `->KeyNegotiation-->Ongoing-->[...] 401 436 // `->Aborting-->NotStarted 402 437 AppendState oldAppendState = m_appendState; … … 434 469 } 435 470 break; 471 case AppendState::KeyNegotiation: 472 switch (newAppendState) { 473 case AppendState::Ongoing: 474 case AppendState::Invalid: 475 ok = true; 476 break; 477 default: 478 break; 479 } 480 break; 436 481 case AppendState::Ongoing: 437 482 switch (newAppendState) { 483 case AppendState::KeyNegotiation: 438 484 case AppendState::Sampling: 439 485 case AppendState::Invalid: … … 537 583 m_demuxerSrcPadCaps = adoptGRef(demuxerSrcPadCaps); 538 584 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Unknown; 539 585 #if ENABLE(ENCRYPTED_MEDIA) 586 if (areEncryptedCaps(m_demuxerSrcPadCaps.get())) { 587 // Any previous decryptor should have been removed from the pipeline by disconnectFromAppSinkFromStreamingThread() 588 ASSERT(!m_decryptor); 589 GstStructure* structure = gst_caps_get_structure(m_demuxerSrcPadCaps.get(), 0); 590 m_decryptor = GStreamerEMEUtilities::createDecryptor(gst_structure_get_string(structure, "protection-system")); 591 if (!m_decryptor) { 592 GST_ERROR("decryptor not found for caps: %" GST_PTR_FORMAT, m_demuxerSrcPadCaps.get()); 593 return; 594 } 595 } 596 #endif 540 597 const char* originalMediaType = capsMediaType(m_demuxerSrcPadCaps.get()); 541 598 if (!MediaPlayerPrivateGStreamerMSE::supportsCodec(originalMediaType)) { … … 617 674 LockHolder locker(m_newSampleLock); 618 675 676 // If we were in KeyNegotiation but samples are coming, assume we're already OnGoing 677 if (m_appendState == AppendState::KeyNegotiation) 678 setAppendState(AppendState::Ongoing); 679 619 680 // Ignore samples if we're not expecting them. Refuse processing if we're in Invalid state. 620 681 if (m_appendState != AppendState::Ongoing && m_appendState != AppendState::Sampling) { … … 949 1010 } 950 1011 1012 #if ENABLE(ENCRYPTED_MEDIA) 1013 if (m_decryptor) { 1014 gst_object_ref(m_decryptor.get()); 1015 gst_bin_add(GST_BIN(m_pipeline.get()), m_decryptor.get()); 1016 gst_element_sync_state_with_parent(m_decryptor.get()); 1017 1018 GRefPtr<GstPad> decryptorSinkPad = adoptGRef(gst_element_get_static_pad(m_decryptor.get(), "sink")); 1019 GRefPtr<GstPad> decryptorSrcPad = adoptGRef(gst_element_get_static_pad(m_decryptor.get(), "src")); 1020 1021 gst_pad_link(currentSrcPad.get(), decryptorSinkPad.get()); 1022 currentSrcPad = decryptorSrcPad; 1023 } 1024 #endif 1025 951 1026 gst_pad_link(currentSrcPad.get(), appsinkSinkPad.get()); 952 1027 953 1028 gst_element_sync_state_with_parent(m_appsink.get()); 954 1029 1030 #if ENABLE(ENCRYPTED_MEDIA) 1031 if (m_pendingDecryptionStructure) 1032 dispatchPendingDecryptionStructure(); 1033 #endif 955 1034 gst_element_set_state(m_pipeline.get(), GST_STATE_PAUSED); 956 1035 gst_element_sync_state_with_parent(m_appsink.get()); … … 1031 1110 GST_DEBUG("Disconnecting appsink"); 1032 1111 1112 #if ENABLE(ENCRYPTED_MEDIA) 1113 if (m_decryptor) { 1114 gst_element_set_state(m_decryptor.get(), GST_STATE_NULL); 1115 gst_bin_remove(GST_BIN(m_pipeline.get()), m_decryptor.get()); 1116 m_decryptor = nullptr; 1117 } 1118 #endif 1119 1033 1120 if (m_parser) { 1034 1121 gst_element_set_state(m_parser.get(), GST_STATE_NULL); … … 1039 1126 GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(m_pipeline.get()), GST_DEBUG_GRAPH_SHOW_ALL, "pad-removed-after"); 1040 1127 } 1128 1129 #if ENABLE(ENCRYPTED_MEDIA) 1130 void AppendPipeline::dispatchPendingDecryptionStructure() 1131 { 1132 ASSERT(m_decryptor); 1133 ASSERT(m_pendingDecryptionStructure); 1134 ASSERT(m_appendState == AppendState::KeyNegotiation); 1135 GST_TRACE("dispatching key to append pipeline %p", this); 1136 1137 // Release the m_pendingDecryptionStructure object since 1138 // gst_event_new_custom() takes over ownership of it. 1139 gst_element_send_event(m_pipeline.get(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, m_pendingDecryptionStructure.release())); 1140 1141 setAppendState(AppendState::Ongoing); 1142 } 1143 1144 void AppendPipeline::dispatchDecryptionStructure(GUniquePtr<GstStructure>&& structure) 1145 { 1146 if (m_appendState == AppendState::KeyNegotiation) { 1147 GST_TRACE("append pipeline %p in key negotiation", this); 1148 m_pendingDecryptionStructure = WTFMove(structure); 1149 if (m_decryptor) 1150 dispatchPendingDecryptionStructure(); 1151 else 1152 GST_TRACE("no decryptor yet, waiting for it"); 1153 } else 1154 GST_TRACE("append pipeline %p not in key negotiation", this); 1155 } 1156 #endif 1041 1157 1042 1158 static void appendPipelineAppsinkCapsChanged(GObject* appsinkPad, GParamSpec*, AppendPipeline* appendPipeline) -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h
r231089 r231091 43 43 class AppendPipeline : public ThreadSafeRefCounted<AppendPipeline> { 44 44 public: 45 enum class AppendState { Invalid, NotStarted, Ongoing, DataStarve, Sampling, LastSample, Aborting };45 enum class AppendState { Invalid, NotStarted, Ongoing, KeyNegotiation, DataStarve, Sampling, LastSample, Aborting }; 46 46 47 47 AppendPipeline(Ref<MediaSourceClientGStreamerMSE>, Ref<SourceBufferPrivateGStreamer>, MediaPlayerPrivateGStreamerMSE&); … … 51 51 void handleApplicationMessage(GstMessage*); 52 52 void handleStateChangeMessage(GstMessage*); 53 #if ENABLE(ENCRYPTED_MEDIA) 54 void handleElementMessage(GstMessage*); 55 #endif 53 56 54 57 gint id(); … … 58 61 GstFlowReturn handleNewAppsinkSample(GstElement*); 59 62 GstFlowReturn pushNewBuffer(GstBuffer*); 63 #if ENABLE(ENCRYPTED_MEDIA) 64 void dispatchDecryptionStructure(GUniquePtr<GstStructure>&&); 65 #endif 60 66 61 67 // Takes ownership of caps. … … 93 99 void removeAppsrcDataLeavingProbe(); 94 100 void setAppsrcDataLeavingProbe(); 101 #if ENABLE(ENCRYPTED_MEDIA) 102 void dispatchPendingDecryptionStructure(); 103 #endif 95 104 96 105 Ref<MediaSourceClientGStreamerMSE> m_mediaSourceClient; … … 110 119 GRefPtr<GstElement> m_demux; 111 120 GRefPtr<GstElement> m_parser; // Optional. 121 #if ENABLE(ENCRYPTED_MEDIA) 122 GRefPtr<GstElement> m_decryptor; 123 #endif 112 124 // The demuxer has one src stream only, so only one appsink is needed and linked to it. 113 125 GRefPtr<GstElement> m_appsink; … … 144 156 145 157 GRefPtr<GstBuffer> m_pendingBuffer; 158 #if ENABLE(ENCRYPTED_MEDIA) 159 GUniquePtr<GstStructure> m_pendingDecryptionStructure; 160 #endif 146 161 }; 147 162 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
r231089 r231091 956 956 gst_structure_set_value(structure.get(), "key-values", &keyValueList); 957 957 958 gst_element_send_event(m_playbackPipeline->pipeline(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, gst_structure_copy(structure.get()))); 958 for (auto it : m_appendPipelinesMap) 959 it.value->dispatchDecryptionStructure(GUniquePtr<GstStructure>(gst_structure_copy(structure.get()))); 959 960 } 960 961 } -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp
r231089 r231091 181 181 GUniquePtr<gchar> parserBinName(g_strdup_printf("streamparser%u", padId)); 182 182 183 if (areEncryptedCaps(caps)) { 184 GST_DEBUG("It's encrypted content, parsers are not needed before decrypting the content"); 185 } else if (!g_strcmp0(mediaType, "video/x-h264")) { 183 if (!g_strcmp0(mediaType, "video/x-h264")) { 186 184 GRefPtr<GstCaps> filterCaps = adoptGRef(gst_caps_new_simple("video/x-h264", "alignment", G_TYPE_STRING, "au", nullptr)); 187 185 GstElement* capsfilter = gst_element_factory_make("capsfilter", nullptr);
Note: See TracChangeset
for help on using the changeset viewer.