Changeset 264175 in webkit
- Timestamp:
- Jul 9, 2020, 9:22:59 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/gstreamer/mse/AppendPipeline.cpp (modified) (2 diffs)
-
platform/graphics/gstreamer/mse/AppendPipeline.h (modified) (1 diff)
-
platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (modified) (3 diffs)
-
platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h (modified) (2 diffs)
-
platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp (modified) (6 diffs)
-
platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp (modified) (1 diff)
-
platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp (modified) (3 diffs)
-
platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r264169 r264175 1 2020-07-09 Alicia Boya García <aboya@igalia.com> 2 3 [MSE][GStreamer] Remove m_appendPipelinesMap 4 https://bugs.webkit.org/show_bug.cgi?id=214132 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 m_appendPipelinesMap was owned by MediaPlayerPrivateGStreamerMSE but 9 was only used by MediaPlayerPrivateGStreamerMSE to clear it during 10 destruction, while the other uses were in 11 MediaSourceClientGStreamerMSE. 12 13 After analysis, it was found keeping a HashMap of AppendPipelines is not 14 necessary. An AppendPipeline only needs to be used by the SourceBuffer 15 receiving the muxed data: making AppendPipeline a member of 16 SourceBufferPrivateGStreamer reflects this dependency in a much 17 clearer way. No need for a HashMap of AppendPipeline's. 18 19 Moreso, there are no other users of AppendPipeline, which means 20 AppendPipeline doesn't need to be ref counted. This patch removes that 21 feature, using std::unique_ptr<AppendPipeline> for ownership instead. 22 23 This patch is a refactor: it doesn't introduce behavior changes and 24 it's covered by existing tests. 25 26 * platform/graphics/gstreamer/mse/AppendPipeline.cpp: 27 (WebCore::AppendPipeline::appsinkCapsChanged): 28 (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): 29 * platform/graphics/gstreamer/mse/AppendPipeline.h: 30 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: 31 (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE): 32 (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): 33 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: 34 * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: 35 (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer): 36 (WebCore::MediaSourceClientGStreamerMSE::abort): 37 (WebCore::MediaSourceClientGStreamerMSE::resetParserState): 38 (WebCore::MediaSourceClientGStreamerMSE::append): 39 (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource): 40 * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp: 41 (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer): 42 * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: 43 (WebCore::SourceBufferPrivateGStreamer::create): 44 (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): 45 (WebCore::SourceBufferPrivateGStreamer::finishCreation): 46 * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: 47 1 48 2020-07-09 Zalan Bujtas <zalan@apple.com> 2 49 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
r264164 r264175 441 441 if (m_appsinkCaps != caps) { 442 442 m_appsinkCaps = WTFMove(caps); 443 m_playerPrivate->trackDetected( this, m_track, previousCapsWereNull);443 m_playerPrivate->trackDetected(*this, m_track, previousCapsWereNull); 444 444 } 445 445 } … … 793 793 794 794 m_appsinkCaps = WTFMove(caps); 795 m_playerPrivate->trackDetected( this, m_track, true);795 m_playerPrivate->trackDetected(*this, m_track, true); 796 796 } 797 797 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h
r251365 r264175 45 45 #endif 46 46 47 class AppendPipeline : public ThreadSafeRefCounted<AppendPipeline> { 47 class AppendPipeline { 48 WTF_MAKE_FAST_ALLOCATED; 48 49 public: 49 50 AppendPipeline(Ref<MediaSourceClientGStreamerMSE>, Ref<SourceBufferPrivateGStreamer>, MediaPlayerPrivateGStreamerMSE&); -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
r264164 r264175 115 115 GST_TRACE("destroying the player (%p)", this); 116 116 117 // Clear the AppendPipeline map. This should cause the destruction of all the AppendPipeline's since there should118 // be no alive references at this point.119 #ifndef NDEBUG120 for (auto iterator : m_appendPipelinesMap)121 ASSERT(iterator.value->hasOneRef());122 #endif123 m_appendPipelinesMap.clear();124 125 117 if (m_source) { 126 118 webKitMediaSrcSetMediaPlayerPrivate(WEBKIT_MEDIA_SRC(m_source.get()), nullptr); … … 711 703 } 712 704 713 void MediaPlayerPrivateGStreamerMSE::trackDetected( RefPtr<AppendPipeline>appendPipeline, RefPtr<WebCore::TrackPrivateBase> newTrack, bool firstTrackDetected)714 { 715 ASSERT(appendPipeline ->track() == newTrack);716 717 GstCaps* caps = appendPipeline ->appsinkCaps();705 void MediaPlayerPrivateGStreamerMSE::trackDetected(AppendPipeline& appendPipeline, RefPtr<WebCore::TrackPrivateBase> newTrack, bool firstTrackDetected) 706 { 707 ASSERT(appendPipeline.track() == newTrack); 708 709 GstCaps* caps = appendPipeline.appsinkCaps(); 718 710 ASSERT(caps); 719 711 GST_DEBUG("track ID: %s, caps: %" GST_PTR_FORMAT, newTrack->id().string().latin1().data(), caps); … … 726 718 727 719 if (firstTrackDetected) 728 m_playbackPipeline->attachTrack(appendPipeline ->sourceBufferPrivate(), newTrack, caps);720 m_playbackPipeline->attachTrack(appendPipeline.sourceBufferPrivate(), newTrack, caps); 729 721 else 730 m_playbackPipeline->reattachTrack(appendPipeline ->sourceBufferPrivate(), newTrack, caps);722 m_playbackPipeline->reattachTrack(appendPipeline.sourceBufferPrivate(), newTrack, caps); 731 723 } 732 724 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
r263656 r264175 78 78 void markEndOfStream(MediaSourcePrivate::EndOfStreamStatus); 79 79 80 void trackDetected( RefPtr<AppendPipeline>, RefPtr<WebCore::TrackPrivateBase>, bool firstTrackDetected);80 void trackDetected(AppendPipeline&, RefPtr<WebCore::TrackPrivateBase>, bool firstTrackDetected); 81 81 void notifySeekNeedsDataForTime(const MediaTime&); 82 82 … … 109 109 RefPtr<MediaSourceClientGStreamerMSE> mediaSourceClient(); 110 110 111 HashMap<RefPtr<SourceBufferPrivateGStreamer>, RefPtr<AppendPipeline>> m_appendPipelinesMap;112 111 bool m_eosMarked = false; 113 112 mutable bool m_eosPending = false; -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp
r264166 r264175 63 63 ASSERT(sourceBufferPrivate); 64 64 65 RefPtr<AppendPipeline> appendPipeline = adoptRef(new AppendPipeline(*this, *sourceBufferPrivate, m_playerPrivate));66 GST_TRACE("Adding SourceBuffer to AppendPipeline: this=%p sourceBuffer=%p appendPipeline=%p", this, sourceBufferPrivate.get(), appendPipeline.get());67 m_playerPrivate.m_appendPipelinesMap.add(sourceBufferPrivate, appendPipeline);68 69 65 return m_playerPrivate.m_playbackPipeline->addSourceBuffer(sourceBufferPrivate); 70 66 } … … 94 90 GST_DEBUG("aborting"); 95 91 96 RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate); 97 98 ASSERT(appendPipeline); 99 100 appendPipeline->resetParserState(); 92 sourceBufferPrivate->appendPipeline().resetParserState(); 101 93 } 102 94 … … 107 99 GST_DEBUG("resetting parser state"); 108 100 109 RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate); 110 111 ASSERT(appendPipeline); 112 113 appendPipeline->resetParserState(); 101 sourceBufferPrivate->appendPipeline().resetParserState(); 114 102 } 115 103 … … 119 107 120 108 GST_DEBUG("Appending %zu bytes", data.size()); 121 122 RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);123 124 ASSERT(appendPipeline);125 109 126 110 // Wrap the whole Vector object in case the data is stored in the inlined buffer. … … 133 117 })); 134 118 135 appendPipeline->pushNewBuffer(WTFMove(buffer));119 sourceBufferPrivate->appendPipeline().pushNewBuffer(WTFMove(buffer)); 136 120 } 137 121 … … 148 132 149 133 ASSERT(m_playerPrivate.m_playbackPipeline); 150 151 // Remove the AppendPipeline from the map. This should cause its destruction since there should be no alive152 // references at this point.153 ASSERT(m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate)->hasOneRef());154 m_playerPrivate.m_appendPipelinesMap.remove(sourceBufferPrivate);155 134 156 135 m_playerPrivate.m_playbackPipeline->removeSourceBuffer(sourceBufferPrivate); -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp
r263656 r264175 79 79 { 80 80 DEBUG_LOG(LOGIDENTIFIER, contentType); 81 sourceBufferPrivate = SourceBufferPrivateGStreamer::create(this, m_client.get(), contentType );81 sourceBufferPrivate = SourceBufferPrivateGStreamer::create(this, m_client.get(), contentType, m_playerPrivate); 82 82 RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivateGStreamer = static_cast<SourceBufferPrivateGStreamer*>(sourceBufferPrivate.get()); 83 83 m_sourceBuffers.add(sourceBufferPrivateGStreamer); -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp
r264161 r264175 38 38 #if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER) 39 39 40 #include "AppendPipeline.h" 40 41 #include "ContentType.h" 41 42 #include "GStreamerCommon.h" … … 49 50 namespace WebCore { 50 51 51 Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType )52 Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType, MediaPlayerPrivateGStreamerMSE& playerPrivate) 52 53 { 53 return adoptRef(*new SourceBufferPrivateGStreamer(mediaSource, client.get(), contentType ));54 return adoptRef(*new SourceBufferPrivateGStreamer(mediaSource, client.get(), contentType, playerPrivate)); 54 55 } 55 56 56 SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType )57 SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType, MediaPlayerPrivateGStreamerMSE& playerPrivate) 57 58 : SourceBufferPrivate() 58 59 , m_mediaSource(mediaSource) 59 60 , m_type(contentType) 60 61 , m_client(client.get()) 62 , m_playerPrivate(playerPrivate) 61 63 #if !RELEASE_LOG_DISABLED 62 64 , m_logger(mediaSource->logger()) … … 64 66 #endif 65 67 { 68 relaxAdoptionRequirement(); 69 m_appendPipeline = WTF::makeUnique<AppendPipeline>(m_client, makeRef(*this), m_playerPrivate); 66 70 } 67 71 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h
r263656 r264175 55 55 56 56 public: 57 static Ref<SourceBufferPrivateGStreamer> create(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType& );57 static Ref<SourceBufferPrivateGStreamer> create(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&, MediaPlayerPrivateGStreamerMSE&); 58 58 virtual ~SourceBufferPrivateGStreamer() = default; 59 59 … … 85 85 ContentType type() const { return m_type; } 86 86 87 AppendPipeline& appendPipeline() { return *m_appendPipeline; } 88 87 89 #if !RELEASE_LOG_DISABLED 88 90 const Logger& logger() const final { return m_logger.get(); } … … 95 97 96 98 private: 97 SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType& );99 SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&, MediaPlayerPrivateGStreamerMSE&); 98 100 friend class MediaSourceClientGStreamerMSE; 99 101 … … 101 103 ContentType m_type; 102 104 Ref<MediaSourceClientGStreamerMSE> m_client; 105 MediaPlayerPrivateGStreamerMSE& m_playerPrivate; 106 std::unique_ptr<AppendPipeline> m_appendPipeline; 103 107 SourceBufferPrivateClient* m_sourceBufferPrivateClient { nullptr }; 104 108 bool m_isReadyForMoreSamples = true;
Note:
See TracChangeset
for help on using the changeset viewer.