Diff
Modified: trunk/Source/WebCore/ChangeLog (264174 => 264175)
--- trunk/Source/WebCore/ChangeLog 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/ChangeLog 2020-07-09 16:22:59 UTC (rev 264175)
@@ -1,3 +1,50 @@
+2020-07-09 Alicia Boya GarcĂa <[email protected]>
+
+ [MSE][GStreamer] Remove m_appendPipelinesMap
+ https://bugs.webkit.org/show_bug.cgi?id=214132
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ m_appendPipelinesMap was owned by MediaPlayerPrivateGStreamerMSE but
+ was only used by MediaPlayerPrivateGStreamerMSE to clear it during
+ destruction, while the other uses were in
+ MediaSourceClientGStreamerMSE.
+
+ After analysis, it was found keeping a HashMap of AppendPipelines is not
+ necessary. An AppendPipeline only needs to be used by the SourceBuffer
+ receiving the muxed data: making AppendPipeline a member of
+ SourceBufferPrivateGStreamer reflects this dependency in a much
+ clearer way. No need for a HashMap of AppendPipeline's.
+
+ Moreso, there are no other users of AppendPipeline, which means
+ AppendPipeline doesn't need to be ref counted. This patch removes that
+ feature, using std::unique_ptr<AppendPipeline> for ownership instead.
+
+ This patch is a refactor: it doesn't introduce behavior changes and
+ it's covered by existing tests.
+
+ * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+ (WebCore::AppendPipeline::appsinkCapsChanged):
+ (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
+ * platform/graphics/gstreamer/mse/AppendPipeline.h:
+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE):
+ (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
+ * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
+ (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
+ (WebCore::MediaSourceClientGStreamerMSE::abort):
+ (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
+ (WebCore::MediaSourceClientGStreamerMSE::append):
+ (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
+ * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
+ (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer):
+ * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
+ (WebCore::SourceBufferPrivateGStreamer::create):
+ (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
+ (WebCore::SourceBufferPrivateGStreamer::finishCreation):
+ * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
+
2020-07-09 Zalan Bujtas <[email protected]>
[LFC][Verification] Use the table wrapper box's margin when checking the table box
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2020-07-09 16:22:59 UTC (rev 264175)
@@ -440,7 +440,7 @@
if (m_appsinkCaps != caps) {
m_appsinkCaps = WTFMove(caps);
- m_playerPrivate->trackDetected(this, m_track, previousCapsWereNull);
+ m_playerPrivate->trackDetected(*this, m_track, previousCapsWereNull);
}
}
@@ -792,7 +792,7 @@
}
m_appsinkCaps = WTFMove(caps);
- m_playerPrivate->trackDetected(this, m_track, true);
+ m_playerPrivate->trackDetected(*this, m_track, true);
}
void AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread(GstPad*)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2020-07-09 16:22:59 UTC (rev 264175)
@@ -44,7 +44,8 @@
};
#endif
-class AppendPipeline : public ThreadSafeRefCounted<AppendPipeline> {
+class AppendPipeline {
+ WTF_MAKE_FAST_ALLOCATED;
public:
AppendPipeline(Ref<MediaSourceClientGStreamerMSE>, Ref<SourceBufferPrivateGStreamer>, MediaPlayerPrivateGStreamerMSE&);
virtual ~AppendPipeline();
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp 2020-07-09 16:22:59 UTC (rev 264175)
@@ -114,14 +114,6 @@
{
GST_TRACE("destroying the player (%p)", this);
- // Clear the AppendPipeline map. This should cause the destruction of all the AppendPipeline's since there should
- // be no alive references at this point.
-#ifndef NDEBUG
- for (auto iterator : m_appendPipelinesMap)
- ASSERT(iterator.value->hasOneRef());
-#endif
- m_appendPipelinesMap.clear();
-
if (m_source) {
webKitMediaSrcSetMediaPlayerPrivate(WEBKIT_MEDIA_SRC(m_source.get()), nullptr);
g_signal_handlers_disconnect_by_data(m_source.get(), this);
@@ -710,11 +702,11 @@
}
}
-void MediaPlayerPrivateGStreamerMSE::trackDetected(RefPtr<AppendPipeline> appendPipeline, RefPtr<WebCore::TrackPrivateBase> newTrack, bool firstTrackDetected)
+void MediaPlayerPrivateGStreamerMSE::trackDetected(AppendPipeline& appendPipeline, RefPtr<WebCore::TrackPrivateBase> newTrack, bool firstTrackDetected)
{
- ASSERT(appendPipeline->track() == newTrack);
+ ASSERT(appendPipeline.track() == newTrack);
- GstCaps* caps = appendPipeline->appsinkCaps();
+ GstCaps* caps = appendPipeline.appsinkCaps();
ASSERT(caps);
GST_DEBUG("track ID: %s, caps: %" GST_PTR_FORMAT, newTrack->id().string().latin1().data(), caps);
@@ -725,9 +717,9 @@
}
if (firstTrackDetected)
- m_playbackPipeline->attachTrack(appendPipeline->sourceBufferPrivate(), newTrack, caps);
+ m_playbackPipeline->attachTrack(appendPipeline.sourceBufferPrivate(), newTrack, caps);
else
- m_playbackPipeline->reattachTrack(appendPipeline->sourceBufferPrivate(), newTrack, caps);
+ m_playbackPipeline->reattachTrack(appendPipeline.sourceBufferPrivate(), newTrack, caps);
}
void MediaPlayerPrivateGStreamerMSE::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& types)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h 2020-07-09 16:22:59 UTC (rev 264175)
@@ -77,7 +77,7 @@
void markEndOfStream(MediaSourcePrivate::EndOfStreamStatus);
- void trackDetected(RefPtr<AppendPipeline>, RefPtr<WebCore::TrackPrivateBase>, bool firstTrackDetected);
+ void trackDetected(AppendPipeline&, RefPtr<WebCore::TrackPrivateBase>, bool firstTrackDetected);
void notifySeekNeedsDataForTime(const MediaTime&);
void blockDurationChanges();
@@ -108,7 +108,6 @@
void setMediaSourceClient(Ref<MediaSourceClientGStreamerMSE>);
RefPtr<MediaSourceClientGStreamerMSE> mediaSourceClient();
- HashMap<RefPtr<SourceBufferPrivateGStreamer>, RefPtr<AppendPipeline>> m_appendPipelinesMap;
bool m_eosMarked = false;
mutable bool m_eosPending = false;
bool m_gstSeekCompleted = true;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp 2020-07-09 16:22:59 UTC (rev 264175)
@@ -62,10 +62,6 @@
ASSERT(m_playerPrivate.m_playbackPipeline);
ASSERT(sourceBufferPrivate);
- RefPtr<AppendPipeline> appendPipeline = adoptRef(new AppendPipeline(*this, *sourceBufferPrivate, m_playerPrivate));
- GST_TRACE("Adding SourceBuffer to AppendPipeline: this=%p sourceBuffer=%p appendPipeline=%p", this, sourceBufferPrivate.get(), appendPipeline.get());
- m_playerPrivate.m_appendPipelinesMap.add(sourceBufferPrivate, appendPipeline);
-
return m_playerPrivate.m_playbackPipeline->addSourceBuffer(sourceBufferPrivate);
}
@@ -93,11 +89,7 @@
GST_DEBUG("aborting");
- RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);
-
- ASSERT(appendPipeline);
-
- appendPipeline->resetParserState();
+ sourceBufferPrivate->appendPipeline().resetParserState();
}
void MediaSourceClientGStreamerMSE::resetParserState(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate)
@@ -106,11 +98,7 @@
GST_DEBUG("resetting parser state");
- RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);
-
- ASSERT(appendPipeline);
-
- appendPipeline->resetParserState();
+ sourceBufferPrivate->appendPipeline().resetParserState();
}
void MediaSourceClientGStreamerMSE::append(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, Vector<unsigned char>&& data)
@@ -119,10 +107,6 @@
GST_DEBUG("Appending %zu bytes", data.size());
- RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);
-
- ASSERT(appendPipeline);
-
// Wrap the whole Vector object in case the data is stored in the inlined buffer.
auto* bufferData = data.data();
auto bufferLength = data.size();
@@ -132,7 +116,7 @@
delete static_cast<Vector<unsigned char>*>(data);
}));
- appendPipeline->pushNewBuffer(WTFMove(buffer));
+ sourceBufferPrivate->appendPipeline().pushNewBuffer(WTFMove(buffer));
}
void MediaSourceClientGStreamerMSE::markEndOfStream(MediaSourcePrivate::EndOfStreamStatus status)
@@ -148,11 +132,6 @@
ASSERT(m_playerPrivate.m_playbackPipeline);
- // Remove the AppendPipeline from the map. This should cause its destruction since there should be no alive
- // references at this point.
- ASSERT(m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate)->hasOneRef());
- m_playerPrivate.m_appendPipelinesMap.remove(sourceBufferPrivate);
-
m_playerPrivate.m_playbackPipeline->removeSourceBuffer(sourceBufferPrivate);
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp 2020-07-09 16:22:59 UTC (rev 264175)
@@ -78,7 +78,7 @@
MediaSourcePrivateGStreamer::AddStatus MediaSourcePrivateGStreamer::addSourceBuffer(const ContentType& contentType, RefPtr<SourceBufferPrivate>& sourceBufferPrivate)
{
DEBUG_LOG(LOGIDENTIFIER, contentType);
- sourceBufferPrivate = SourceBufferPrivateGStreamer::create(this, m_client.get(), contentType);
+ sourceBufferPrivate = SourceBufferPrivateGStreamer::create(this, m_client.get(), contentType, m_playerPrivate);
RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivateGStreamer = static_cast<SourceBufferPrivateGStreamer*>(sourceBufferPrivate.get());
m_sourceBuffers.add(sourceBufferPrivateGStreamer);
return m_client->addSourceBuffer(sourceBufferPrivateGStreamer, contentType);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp 2020-07-09 16:22:59 UTC (rev 264175)
@@ -37,6 +37,7 @@
#if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)
+#include "AppendPipeline.h"
#include "ContentType.h"
#include "GStreamerCommon.h"
#include "MediaPlayerPrivateGStreamerMSE.h"
@@ -48,21 +49,24 @@
namespace WebCore {
-Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType)
+Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType, MediaPlayerPrivateGStreamerMSE& playerPrivate)
{
- return adoptRef(*new SourceBufferPrivateGStreamer(mediaSource, client.get(), contentType));
+ return adoptRef(*new SourceBufferPrivateGStreamer(mediaSource, client.get(), contentType, playerPrivate));
}
-SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType)
+SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType, MediaPlayerPrivateGStreamerMSE& playerPrivate)
: SourceBufferPrivate()
, m_mediaSource(mediaSource)
, m_type(contentType)
, m_client(client.get())
+ , m_playerPrivate(playerPrivate)
#if !RELEASE_LOG_DISABLED
, m_logger(mediaSource->logger())
, m_logIdentifier(mediaSource->nextSourceBufferLogIdentifier())
#endif
{
+ relaxAdoptionRequirement();
+ m_appendPipeline = WTF::makeUnique<AppendPipeline>(m_client, makeRef(*this), m_playerPrivate);
}
void SourceBufferPrivateGStreamer::setClient(SourceBufferPrivateClient* client)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h (264174 => 264175)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h 2020-07-09 16:07:29 UTC (rev 264174)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h 2020-07-09 16:22:59 UTC (rev 264175)
@@ -54,7 +54,7 @@
{
public:
- static Ref<SourceBufferPrivateGStreamer> create(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&);
+ static Ref<SourceBufferPrivateGStreamer> create(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&, MediaPlayerPrivateGStreamerMSE&);
virtual ~SourceBufferPrivateGStreamer() = default;
void clearMediaSource() { m_mediaSource = nullptr; }
@@ -84,6 +84,8 @@
ContentType type() const { return m_type; }
+ AppendPipeline& appendPipeline() { return *m_appendPipeline; }
+
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger.get(); }
const char* logClassName() const override { return "SourceBufferPrivateGStreamer"; }
@@ -94,12 +96,14 @@
#endif
private:
- SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&);
+ SourceBufferPrivateGStreamer(MediaSourcePrivateGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&, MediaPlayerPrivateGStreamerMSE&);
friend class MediaSourceClientGStreamerMSE;
MediaSourcePrivateGStreamer* m_mediaSource;
ContentType m_type;
Ref<MediaSourceClientGStreamerMSE> m_client;
+ MediaPlayerPrivateGStreamerMSE& m_playerPrivate;
+ std::unique_ptr<AppendPipeline> m_appendPipeline;
SourceBufferPrivateClient* m_sourceBufferPrivateClient { nullptr };
bool m_isReadyForMoreSamples = true;
bool m_notifyWhenReadyForMoreSamples = false;