Changeset 276493 in webkit
- Timestamp:
- Apr 23, 2021, 2:46:01 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
html/HTMLMediaElement.cpp (modified) (1 diff)
-
html/HTMLMediaElement.h (modified) (2 diffs)
-
platform/graphics/MediaPlayer.cpp (modified) (1 diff)
-
platform/graphics/MediaPlayer.h (modified) (2 diffs)
-
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (modified) (7 diffs)
-
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r276492 r276493 1 2021-04-23 Philippe Normand <pnormand@igalia.com> 2 3 [Media] Allow access to MediaElement id from MediaPlayerPrivate 4 https://bugs.webkit.org/show_bug.cgi?id=224818 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 A new method is added in the MediaPlayer allowing to query the client media element for its 9 identifier. That could be useful for accurate naming of the internal player/pipeline in the 10 MediaPlayerPrivate. If no specific id was set on the media element then the id is empty 11 string and the MediaPlayerPrivate needs to handle that by forging a unique id. 12 13 This also lead me to simplify pipeline-related code in the GStreamer player. The player can 14 handle only one pipeline in its entire life-time so the code handling pipeline "re-loading" 15 was actually never hit. 16 17 * html/HTMLMediaElement.cpp: 18 (WebCore::HTMLMediaElement::parseAttribute): 19 * html/HTMLMediaElement.h: 20 * platform/graphics/MediaPlayer.cpp: 21 (WebCore::MediaPlayer::elementId const): 22 * platform/graphics/MediaPlayer.h: 23 (WebCore::MediaPlayerClient::mediaPlayerElementId const): 24 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 25 (WebCore::MediaPlayerPrivateGStreamer::load): 26 (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): 27 (WebCore::MediaPlayerPrivateGStreamer::loadFull): Deleted. 28 (WebCore::MediaPlayerPrivateGStreamer::setPipeline): Deleted. 29 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 30 1 31 2021-04-22 Sergio Villar Senin <svillar@igalia.com> 2 32 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r276389 r276493 713 713 void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomString& value) 714 714 { 715 if (name == idAttr) 716 m_id = value; 717 715 718 if (name == srcAttr) { 716 719 // https://html.spec.whatwg.org/multipage/embedded-content.html#location-of-the-media-resource -
trunk/Source/WebCore/html/HTMLMediaElement.h
r276389 r276493 726 726 Vector<String> mediaPlayerPreferredAudioCharacteristics() const override; 727 727 728 String mediaPlayerElementId() const override { return m_id; } 729 728 730 #if PLATFORM(IOS_FAMILY) 729 731 String mediaPlayerNetworkInterfaceName() const override; … … 1200 1202 String m_audioOutputHashedDeviceId; 1201 1203 #endif 1204 String m_id; 1202 1205 }; 1203 1206 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r276267 r276493 1670 1670 } 1671 1671 1672 String MediaPlayer::elementId() const 1673 { 1674 return client().mediaPlayerElementId(); 1675 } 1676 1672 1677 #if !RELEASE_LOG_DISABLED 1673 1678 const Logger& MediaPlayer::mediaPlayerLogger() -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r274021 r276493 259 259 virtual String mediaPlayerSourceApplicationIdentifier() const { return emptyString(); } 260 260 261 virtual String mediaPlayerElementId() const { return emptyString(); } 262 261 263 virtual void mediaPlayerEngineFailedToLoad() const { } 262 264 … … 549 551 String engineDescription() const; 550 552 long platformErrorCode() const; 553 554 String elementId() const; 551 555 552 556 CachedResourceLoader* cachedResourceLoader(); -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r276198 r276493 303 303 } 304 304 305 void MediaPlayerPrivateGStreamer::load Full(const String& urlString, const String& pipelineName)305 void MediaPlayerPrivateGStreamer::load(const String& urlString) 306 306 { 307 307 URL url(URL(), urlString); … … 319 319 320 320 if (!m_pipeline) 321 createGSTPlayBin(url , pipelineName);321 createGSTPlayBin(url); 322 322 syncOnClock(true); 323 323 if (m_fillTimer.isActive()) … … 347 347 } 348 348 349 void MediaPlayerPrivateGStreamer::load(const String& urlString)350 {351 loadFull(urlString, String());352 }353 354 349 #if ENABLE(MEDIA_SOURCE) 355 350 void MediaPlayerPrivateGStreamer::load(const URL&, const ContentType&, MediaSourcePrivateClient*) … … 365 360 { 366 361 m_streamPrivate = &stream; 367 static Atomic<uint32_t> pipelineId; 368 auto pipelineName = makeString("mediastream-", pipelineId.exchangeAdd(1)); 369 370 loadFull(String("mediastream://") + stream.id(), pipelineName); 362 load(String("mediastream://") + stream.id()); 371 363 syncOnClock(false); 372 364 … … 1542 1534 player->notifyPlayerOfVideo(); 1543 1535 }); 1544 }1545 1546 void MediaPlayerPrivateGStreamer::setPipeline(GstElement* pipeline)1547 {1548 if (!pipeline) {1549 GST_WARNING("Playbin not found, make sure to install gst-plugins-base");1550 loadingFailed(MediaPlayer::NetworkState::FormatError, MediaPlayer::ReadyState::HaveNothing, true);1551 return;1552 }1553 1554 m_pipeline = pipeline;1555 1536 } 1556 1537 … … 2696 2677 } 2697 2678 2698 void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url , const String& pipelineName)2679 void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url) 2699 2680 { 2700 2681 GST_INFO("Creating pipeline for %s player", m_player->isVideoPlayer() ? "video" : "audio"); … … 2708 2689 playbinName = "playbin3"; 2709 2690 2710 if (m_pipeline) {2711 if (!g_strcmp0(GST_OBJECT_NAME(gst_element_get_factory(m_pipeline.get())), playbinName)) {2712 GST_INFO_OBJECT(pipeline(), "Already using %s", playbinName);2713 return;2714 }2715 2716 GST_INFO_OBJECT(pipeline(), "Tearing down as we need to use %s now.", playbinName);2717 changePipelineState(GST_STATE_NULL);2718 m_pipeline = nullptr;2719 m_audioSink = nullptr;2720 }2721 2722 2691 ASSERT(!m_pipeline); 2723 2692 2693 auto elementId = m_player->elementId(); 2694 if (elementId.isEmpty()) 2695 elementId = "media-player"; 2696 2697 const char* type = isMediaSource() ? "MSE-" : url.protocolIs("mediastream") ? "mediastream-" : ""; 2698 2724 2699 m_isLegacyPlaybin = !g_strcmp0(playbinName, "playbin"); 2725 2700 2726 2701 static Atomic<uint32_t> pipelineId; 2727 setPipeline(gst_element_factory_make(playbinName, 2728 (pipelineName.isEmpty() ? makeString("media-player-", pipelineId.exchangeAdd(1)) : pipelineName).utf8().data())); 2702 2703 m_pipeline = adoptGRef(gst_element_factory_make(playbinName, makeString(type, elementId, '-', pipelineId.exchangeAdd(1)).ascii().data())); 2704 if (!m_pipeline) { 2705 GST_WARNING("%s not found, make sure to install gst-plugins-base", playbinName); 2706 loadingFailed(MediaPlayer::NetworkState::FormatError, MediaPlayer::ReadyState::HaveNothing, true); 2707 return; 2708 } 2709 2729 2710 setStreamVolumeElement(GST_STREAM_VOLUME(m_pipeline.get())); 2730 2711 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
r276197 r276493 281 281 void setStreamVolumeElement(GstStreamVolume*); 282 282 283 void setPipeline(GstElement*);284 283 GstElement* pipeline() const { return m_pipeline.get(); } 285 284 … … 412 411 virtual void asyncStateChangeDone(); 413 412 414 void createGSTPlayBin(const URL& , const String& pipelineName);413 void createGSTPlayBin(const URL&); 415 414 416 415 bool loadNextLocation(); … … 444 443 445 444 void setPlaybinURL(const URL& urlString); 446 void loadFull(const String& url, const String& pipelineName);447 445 448 446 void updateTracks(const GRefPtr<GstStreamCollection>&);
Note:
See TracChangeset
for help on using the changeset viewer.