Title: [240790] trunk/Source/WebCore
Revision
240790
Author
[email protected]
Date
2019-01-31 09:02:29 -0800 (Thu, 31 Jan 2019)

Log Message

[MSE][GStreamer] Use reference instead of pointer in m_playerPrivate
https://bugs.webkit.org/show_bug.cgi?id=194091

Reviewed by Xabier Rodriguez-Calvar.

Since the pointer is initialized with the class, it's never null and
never changes, it's preferrable to use a reference instead of a
pointer.

* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
(WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE):
(WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
(WebCore::MediaSourceClientGStreamerMSE::durationChanged):
(WebCore::MediaSourceClientGStreamerMSE::abort):
(WebCore::MediaSourceClientGStreamerMSE::resetParserState):
(WebCore::MediaSourceClientGStreamerMSE::append):
(WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
(WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
(WebCore::MediaSourceClientGStreamerMSE::flush):
(WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
(WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
(WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc):
* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240789 => 240790)


--- trunk/Source/WebCore/ChangeLog	2019-01-31 16:52:22 UTC (rev 240789)
+++ trunk/Source/WebCore/ChangeLog	2019-01-31 17:02:29 UTC (rev 240790)
@@ -1,3 +1,29 @@
+2019-01-31  Alicia Boya GarcĂ­a  <[email protected]>
+
+        [MSE][GStreamer] Use reference instead of pointer in m_playerPrivate
+        https://bugs.webkit.org/show_bug.cgi?id=194091
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Since the pointer is initialized with the class, it's never null and
+        never changes, it's preferrable to use a reference instead of a
+        pointer.
+
+        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
+        (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE):
+        (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
+        (WebCore::MediaSourceClientGStreamerMSE::durationChanged):
+        (WebCore::MediaSourceClientGStreamerMSE::abort):
+        (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
+        (WebCore::MediaSourceClientGStreamerMSE::append):
+        (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
+        (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
+        (WebCore::MediaSourceClientGStreamerMSE::flush):
+        (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
+        (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
+        (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc):
+        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
+
 2019-01-31  Alexander Mikhaylenko  <[email protected]>
 
         [GTK] Momentum scrolling stops abruptly before websites end

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp (240789 => 240790)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp	2019-01-31 16:52:22 UTC (rev 240789)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp	2019-01-31 17:02:29 UTC (rev 240790)
@@ -45,7 +45,7 @@
 }
 
 MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE(MediaPlayerPrivateGStreamerMSE& playerPrivate)
-    : m_playerPrivate(&playerPrivate)
+    : m_playerPrivate(playerPrivate)
     , m_duration(MediaTime::invalidTime())
 {
     ASSERT(WTF::isMainThread());
@@ -60,14 +60,14 @@
 {
     ASSERT(WTF::isMainThread());
 
-    ASSERT(m_playerPrivate->m_playbackPipeline);
+    ASSERT(m_playerPrivate.m_playbackPipeline);
     ASSERT(sourceBufferPrivate);
 
-    RefPtr<AppendPipeline> appendPipeline = adoptRef(new AppendPipeline(*this, *sourceBufferPrivate, *m_playerPrivate));
+    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);
+    m_playerPrivate.m_appendPipelinesMap.add(sourceBufferPrivate, appendPipeline);
 
-    return m_playerPrivate->m_playbackPipeline->addSourceBuffer(sourceBufferPrivate);
+    return m_playerPrivate.m_playbackPipeline->addSourceBuffer(sourceBufferPrivate);
 }
 
 const MediaTime& MediaSourceClientGStreamerMSE::duration()
@@ -86,7 +86,7 @@
         return;
 
     m_duration = duration;
-    m_playerPrivate->durationChanged();
+    m_playerPrivate.durationChanged();
 }
 
 void MediaSourceClientGStreamerMSE::abort(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate)
@@ -95,7 +95,7 @@
 
     GST_DEBUG("aborting");
 
-    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate);
+    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);
 
     ASSERT(appendPipeline);
 
@@ -108,7 +108,7 @@
 
     GST_DEBUG("resetting parser state");
 
-    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate);
+    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);
 
     ASSERT(appendPipeline);
 
@@ -123,7 +123,7 @@
 
     ASSERT(m_playerPrivate);
 
-    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate);
+    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate);
 
     ASSERT(appendPipeline);
 
@@ -143,7 +143,7 @@
 {
     ASSERT(WTF::isMainThread());
 
-    m_playerPrivate->markEndOfStream(status);
+    m_playerPrivate.markEndOfStream(status);
 }
 
 void MediaSourceClientGStreamerMSE::removedFromMediaSource(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate)
@@ -150,14 +150,14 @@
 {
     ASSERT(WTF::isMainThread());
 
-    ASSERT(m_playerPrivate->m_playbackPipeline);
+    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);
+    ASSERT(m_playerPrivate.m_appendPipelinesMap.get(sourceBufferPrivate)->hasOneRef());
+    m_playerPrivate.m_appendPipelinesMap.remove(sourceBufferPrivate);
 
-    m_playerPrivate->m_playbackPipeline->removeSourceBuffer(sourceBufferPrivate);
+    m_playerPrivate.m_playbackPipeline->removeSourceBuffer(sourceBufferPrivate);
 }
 
 void MediaSourceClientGStreamerMSE::flush(AtomicString trackId)
@@ -165,8 +165,8 @@
     ASSERT(WTF::isMainThread());
 
     // This is only for on-the-fly reenqueues after appends. When seeking, the seek will do its own flush.
-    if (!m_playerPrivate->m_seeking)
-        m_playerPrivate->m_playbackPipeline->flush(trackId);
+    if (!m_playerPrivate.m_seeking)
+        m_playerPrivate.m_playbackPipeline->flush(trackId);
 }
 
 void MediaSourceClientGStreamerMSE::enqueueSample(Ref<MediaSample>&& sample)
@@ -173,7 +173,7 @@
 {
     ASSERT(WTF::isMainThread());
 
-    m_playerPrivate->m_playbackPipeline->enqueueSample(WTFMove(sample));
+    m_playerPrivate.m_playbackPipeline->enqueueSample(WTFMove(sample));
 }
 
 void MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued(const AtomicString& trackId)
@@ -180,7 +180,7 @@
 {
     ASSERT(WTF::isMainThread());
 
-    m_playerPrivate->m_playbackPipeline->allSamplesInTrackEnqueued(trackId);
+    m_playerPrivate.m_playbackPipeline->allSamplesInTrackEnqueued(trackId);
 }
 
 GRefPtr<WebKitMediaSrc> MediaSourceClientGStreamerMSE::webKitMediaSrc()
@@ -187,7 +187,7 @@
 {
     ASSERT(WTF::isMainThread());
 
-    WebKitMediaSrc* source = WEBKIT_MEDIA_SRC(m_playerPrivate->m_source.get());
+    WebKitMediaSrc* source = WEBKIT_MEDIA_SRC(m_playerPrivate.m_source.get());
 
     ASSERT(WEBKIT_IS_MEDIA_SRC(source));
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h (240789 => 240790)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h	2019-01-31 16:52:22 UTC (rev 240789)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h	2019-01-31 17:02:29 UTC (rev 240790)
@@ -60,7 +60,7 @@
 private:
     MediaSourceClientGStreamerMSE(MediaPlayerPrivateGStreamerMSE&);
 
-    MediaPlayerPrivateGStreamerMSE* m_playerPrivate;
+    MediaPlayerPrivateGStreamerMSE& m_playerPrivate;
     MediaTime m_duration;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to