[MSE][GStreamer] Use GRefPtr in AppendPipeline::pushNewBuffer()
authoraboya@igalia.com <aboya@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 12:46:18 +0000 (12:46 +0000)
committeraboya@igalia.com <aboya@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 12:46:18 +0000 (12:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192934

Reviewed by Xabier Rodriguez-Calvar.

* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::pushNewBuffer):
* platform/graphics/gstreamer/mse/AppendPipeline.h:
* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
(WebCore::MediaSourceClientGStreamerMSE::append):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239826 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h
Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp

index 888ee59..fd7b18e 100644 (file)
@@ -1,3 +1,16 @@
+2019-01-10  Alicia Boya GarcĂ­a  <aboya@igalia.com>
+
+        [MSE][GStreamer] Use GRefPtr in AppendPipeline::pushNewBuffer()
+        https://bugs.webkit.org/show_bug.cgi?id=192934
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+        (WebCore::AppendPipeline::pushNewBuffer):
+        * platform/graphics/gstreamer/mse/AppendPipeline.h:
+        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
+        (WebCore::MediaSourceClientGStreamerMSE::append):
+
 2019-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [FreeType] Color emoji not properly supported
index 57a1b5c..4340b9c 100644 (file)
@@ -552,10 +552,10 @@ void AppendPipeline::resetParserState()
 #endif
 }
 
-GstFlowReturn AppendPipeline::pushNewBuffer(GstBuffer* buffer)
+GstFlowReturn AppendPipeline::pushNewBuffer(GRefPtr<GstBuffer>&& buffer)
 {
-    GST_TRACE_OBJECT(m_pipeline.get(), "pushing data buffer %" GST_PTR_FORMAT, buffer);
-    GstFlowReturn pushDataBufferRet = gst_app_src_push_buffer(GST_APP_SRC(m_appsrc.get()), buffer);
+    GST_TRACE_OBJECT(m_pipeline.get(), "pushing data buffer %" GST_PTR_FORMAT, buffer.get());
+    GstFlowReturn pushDataBufferRet = gst_app_src_push_buffer(GST_APP_SRC(m_appsrc.get()), buffer.leakRef());
     // Pushing buffers to appsrc can only fail if the appsrc is flushing, in EOS or stopped. Neither of these should
     // be true at this point.
     g_return_val_if_fail(pushDataBufferRet == GST_FLOW_OK, GST_FLOW_ERROR);
index d3a520d..d595989 100644 (file)
@@ -49,7 +49,7 @@ public:
     AppendPipeline(Ref<MediaSourceClientGStreamerMSE>, Ref<SourceBufferPrivateGStreamer>, MediaPlayerPrivateGStreamerMSE&);
     virtual ~AppendPipeline();
 
-    GstFlowReturn pushNewBuffer(GstBuffer*);
+    GstFlowReturn pushNewBuffer(GRefPtr<GstBuffer>&&);
     void resetParserState();
     Ref<SourceBufferPrivateGStreamer> sourceBufferPrivate() { return m_sourceBufferPrivate.get(); }
     GstCaps* appsinkCaps() { return m_appsinkCaps.get(); }
index c84fc36..b37adae 100644 (file)
@@ -141,13 +141,13 @@ bool MediaSourceClientGStreamerMSE::append(RefPtr<SourceBufferPrivateGStreamer>
     // Wrap the whole Vector object in case the data is stored in the inlined buffer.
     auto* bufferData = data.data();
     auto bufferLength = data.size();
-    GstBuffer* buffer = gst_buffer_new_wrapped_full(static_cast<GstMemoryFlags>(0), bufferData, bufferLength, 0, bufferLength, new Vector<unsigned char>(WTFMove(data)),
+    GRefPtr<GstBuffer> buffer = adoptGRef(gst_buffer_new_wrapped_full(static_cast<GstMemoryFlags>(0), bufferData, bufferLength, 0, bufferLength, new Vector<unsigned char>(WTFMove(data)),
         [](gpointer data)
         {
             delete static_cast<Vector<unsigned char>*>(data);
-        });
+        }));
 
-    return appendPipeline->pushNewBuffer(buffer) == GST_FLOW_OK;
+    return appendPipeline->pushNewBuffer(WTFMove(buffer)) == GST_FLOW_OK;
 }
 
 void MediaSourceClientGStreamerMSE::markEndOfStream(MediaSourcePrivate::EndOfStreamStatus status)