Title: [265494] trunk/Source/WebCore
- Revision
- 265494
- Author
- ab...@igalia.com
- Date
- 2020-08-11 04:41:11 -0700 (Tue, 11 Aug 2020)
Log Message
[MSE][GStreamer] Remove m_sourceBufferPrivateClient checks in SourceBufferPrivateGStreamer
https://bugs.webkit.org/show_bug.cgi?id=215263
Reviewed by Xabier Rodriguez-Calvar.
m_sourceBufferPrivateClient is only reset to NULL from SourceBuffer's
destructor. At this point SourceBufferPrivateGStreamer is about to
receive its last unref by SourceBuffer and therefore be destroyed.
Similarly, there is no need to check for m_mediaSource being null.
m_mediaSource is only reset when the SourceBuffer is removed, and at
that point SourceBufferPrivate shouldn't receive any calls.
This is a clean-up and doesn't introduce new behavior. Asserts have
been added checking the precondition above.
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
(WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment):
(WebCore::SourceBufferPrivateGStreamer::didReceiveSample):
(WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples):
(WebCore::SourceBufferPrivateGStreamer::appendParsingFailed):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (265493 => 265494)
--- trunk/Source/WebCore/ChangeLog 2020-08-11 08:23:16 UTC (rev 265493)
+++ trunk/Source/WebCore/ChangeLog 2020-08-11 11:41:11 UTC (rev 265494)
@@ -1,3 +1,28 @@
+2020-08-11 Alicia Boya GarcĂa <ab...@igalia.com>
+
+ [MSE][GStreamer] Remove m_sourceBufferPrivateClient checks in SourceBufferPrivateGStreamer
+ https://bugs.webkit.org/show_bug.cgi?id=215263
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ m_sourceBufferPrivateClient is only reset to NULL from SourceBuffer's
+ destructor. At this point SourceBufferPrivateGStreamer is about to
+ receive its last unref by SourceBuffer and therefore be destroyed.
+
+ Similarly, there is no need to check for m_mediaSource being null.
+ m_mediaSource is only reset when the SourceBuffer is removed, and at
+ that point SourceBufferPrivate shouldn't receive any calls.
+
+ This is a clean-up and doesn't introduce new behavior. Asserts have
+ been added checking the precondition above.
+
+ * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
+ (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
+ (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment):
+ (WebCore::SourceBufferPrivateGStreamer::didReceiveSample):
+ (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples):
+ (WebCore::SourceBufferPrivateGStreamer::appendParsingFailed):
+
2020-08-11 Philippe Normand <pnorm...@igalia.com>
[GStreamer] gst-full standalone library support
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp (265493 => 265494)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp 2020-08-11 08:23:16 UTC (rev 265493)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp 2020-08-11 11:41:11 UTC (rev 265494)
@@ -69,6 +69,9 @@
void SourceBufferPrivateGStreamer::setClient(SourceBufferPrivateClient* client)
{
+ // setClient(nullptr) is only called from SourceBuffer destructor. At that point, SourceBuffer is also the
+ // owner of the last reference to us, so we're about to be destroyed.
+ ASSERT(client || refCount() == 1);
m_sourceBufferPrivateClient = client;
}
@@ -108,9 +111,11 @@
void SourceBufferPrivateGStreamer::removedFromMediaSource()
{
ASSERT(isMainThread());
- if (m_mediaSource)
- m_mediaSource->removeSourceBuffer(this);
+ m_mediaSource->removeSourceBuffer(this);
m_playerPrivate.playbackPipeline()->removeSourceBuffer(this);
+ // After this only SourceBuffer should hold a reference to us, which will be destroyed eventually (when JS
+ // GC releases the last reference). Until then SourceBuffer is in "removed" state and won't use SourceBufferPrivate.
+ ASSERT(refCount() == 1);
}
MediaPlayer::ReadyState SourceBufferPrivateGStreamer::readyState() const
@@ -167,8 +172,7 @@
void SourceBufferPrivateGStreamer::setActive(bool isActive)
{
- if (m_mediaSource)
- m_mediaSource->sourceBufferPrivateDidChangeActiveState(this, isActive);
+ m_mediaSource->sourceBufferPrivateDidChangeActiveState(this, isActive);
}
void SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples(const AtomString& trackId)
@@ -180,26 +184,22 @@
void SourceBufferPrivateGStreamer::didReceiveInitializationSegment(const SourceBufferPrivateClient::InitializationSegment& initializationSegment)
{
- if (m_sourceBufferPrivateClient)
- m_sourceBufferPrivateClient->sourceBufferPrivateDidReceiveInitializationSegment(initializationSegment);
+ m_sourceBufferPrivateClient->sourceBufferPrivateDidReceiveInitializationSegment(initializationSegment);
}
void SourceBufferPrivateGStreamer::didReceiveSample(MediaSample& sample)
{
- if (m_sourceBufferPrivateClient)
- m_sourceBufferPrivateClient->sourceBufferPrivateDidReceiveSample(sample);
+ m_sourceBufferPrivateClient->sourceBufferPrivateDidReceiveSample(sample);
}
void SourceBufferPrivateGStreamer::didReceiveAllPendingSamples()
{
- if (m_sourceBufferPrivateClient)
- m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(SourceBufferPrivateClient::AppendSucceeded);
+ m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(SourceBufferPrivateClient::AppendSucceeded);
}
void SourceBufferPrivateGStreamer::appendParsingFailed()
{
- if (m_sourceBufferPrivateClient)
- m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(SourceBufferPrivateClient::ParsingFailed);
+ m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(SourceBufferPrivateClient::ParsingFailed);
}
#if !RELEASE_LOG_DISABLED
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes