Title: [226357] trunk/Source/WebCore
Revision
226357
Author
[email protected]
Date
2018-01-03 02:58:21 -0800 (Wed, 03 Jan 2018)

Log Message

[GStreamer] move MediaSample implementation out of mse/
https://bugs.webkit.org/show_bug.cgi?id=179165

Reviewed by Carlos Garcia Campos.

This module isn't specific to MSE and can potentially be reused
elsewhere, for WebRTC for instance. Additionally the
::platformSample() method was implemented and the code was cleaned up.

* platform/GStreamer.cmake:
* platform/MediaSample.h:
* platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp.
(WebCore::GStreamerMediaSample::platformSample):
* platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h.
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
(WebCore::PlaybackPipeline::enqueueSample):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226356 => 226357)


--- trunk/Source/WebCore/ChangeLog	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/ChangeLog	2018-01-03 10:58:21 UTC (rev 226357)
@@ -1,3 +1,22 @@
+2018-01-03  Philippe Normand  <[email protected]>
+
+        [GStreamer] move MediaSample implementation out of mse/
+        https://bugs.webkit.org/show_bug.cgi?id=179165
+
+        Reviewed by Carlos Garcia Campos.
+
+        This module isn't specific to MSE and can potentially be reused
+        elsewhere, for WebRTC for instance. Additionally the
+        ::platformSample() method was implemented and the code was cleaned up.
+
+        * platform/GStreamer.cmake:
+        * platform/MediaSample.h:
+        * platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp.
+        (WebCore::GStreamerMediaSample::platformSample):
+        * platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h.
+        * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
+        (WebCore::PlaybackPipeline::enqueueSample):
+
 2018-01-03  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Fix resource load stats tests on GLib based ports after r226355.

Modified: trunk/Source/WebCore/platform/GStreamer.cmake (226356 => 226357)


--- trunk/Source/WebCore/platform/GStreamer.cmake	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/platform/GStreamer.cmake	2018-01-03 10:58:21 UTC (rev 226357)
@@ -12,6 +12,7 @@
         platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp
         platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
         platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
+        platform/graphics/gstreamer/MediaSampleGStreamer.cpp
         platform/graphics/gstreamer/TextCombinerGStreamer.cpp
         platform/graphics/gstreamer/TextSinkGStreamer.cpp
         platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp
@@ -25,7 +26,6 @@
 
         platform/graphics/gstreamer/mse/AppendPipeline.cpp
         platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp
-        platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp
         platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
         platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp
         platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp

Modified: trunk/Source/WebCore/platform/MediaSample.h (226356 => 226357)


--- trunk/Source/WebCore/platform/MediaSample.h	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/platform/MediaSample.h	2018-01-03 10:58:21 UTC (rev 226357)
@@ -33,6 +33,7 @@
 #include <wtf/text/AtomicString.h>
 
 typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
+typedef struct _GstSample GstSample;
 
 namespace WebCore {
 
@@ -43,10 +44,12 @@
         None,
         MockSampleBoxType,
         CMSampleBufferType,
+        GStreamerSampleType,
     } type;
     union {
         MockSampleBox* mockSampleBox;
         CMSampleBufferRef cmSampleBuffer;
+        GstSample* gstSample;
     } sample;
 };
 

Copied: trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp (from rev 226356, trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp) (0 => 226357)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp	2018-01-03 10:58:21 UTC (rev 226357)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2016 Metrological Group B.V.
+ * Copyright (C) 2016, 2017, 2018 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * aint with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "MediaSampleGStreamer.h"
+
+#include "GStreamerUtilities.h"
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+
+namespace WebCore {
+
+MediaSampleGStreamer::MediaSampleGStreamer(GRefPtr<GstSample>&& sample, const FloatSize& presentationSize, const AtomicString& trackId)
+    : m_pts(MediaTime::zeroTime())
+    , m_dts(MediaTime::zeroTime())
+    , m_duration(MediaTime::zeroTime())
+    , m_trackId(trackId)
+    , m_presentationSize(presentationSize)
+{
+    ASSERT(sample);
+    GstBuffer* buffer = gst_sample_get_buffer(sample.get());
+    if (!buffer)
+        return;
+
+    auto createMediaTime =
+        [](GstClockTime time) -> MediaTime {
+            return MediaTime(GST_TIME_AS_USECONDS(time), G_USEC_PER_SEC);
+        };
+
+    if (GST_BUFFER_PTS_IS_VALID(buffer))
+        m_pts = createMediaTime(GST_BUFFER_PTS(buffer));
+    if (GST_BUFFER_DTS_IS_VALID(buffer) || GST_BUFFER_PTS_IS_VALID(buffer))
+        m_dts = createMediaTime(GST_BUFFER_DTS_OR_PTS(buffer));
+    if (GST_BUFFER_DURATION_IS_VALID(buffer))
+        m_duration = createMediaTime(GST_BUFFER_DURATION(buffer));
+
+    m_size = gst_buffer_get_size(buffer);
+    m_sample = sample;
+
+    if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT))
+        m_flags = MediaSample::None;
+
+    if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DECODE_ONLY))
+        m_flags = static_cast<MediaSample::SampleFlags>(m_flags | MediaSample::IsNonDisplaying);
+}
+
+MediaSampleGStreamer::MediaSampleGStreamer(const FloatSize& presentationSize, const AtomicString& trackId)
+    : m_pts(MediaTime::zeroTime())
+    , m_dts(MediaTime::zeroTime())
+    , m_duration(MediaTime::zeroTime())
+    , m_trackId(trackId)
+    , m_presentationSize(presentationSize)
+{
+}
+
+Ref<MediaSampleGStreamer> MediaSampleGStreamer::createFakeSample(GstCaps*, MediaTime pts, MediaTime dts, MediaTime duration, const FloatSize& presentationSize, const AtomicString& trackId)
+{
+    MediaSampleGStreamer* gstreamerMediaSample = new MediaSampleGStreamer(presentationSize, trackId);
+    gstreamerMediaSample->m_pts = pts;
+    gstreamerMediaSample->m_dts = dts;
+    gstreamerMediaSample->m_duration = duration;
+    gstreamerMediaSample->m_flags = MediaSample::IsNonDisplaying;
+    return adoptRef(*gstreamerMediaSample);
+}
+
+void MediaSampleGStreamer::applyPtsOffset(MediaTime timestampOffset)
+{
+    if (m_pts > timestampOffset) {
+        m_duration = m_duration + (m_pts - timestampOffset);
+        m_pts = timestampOffset;
+    }
+}
+
+void MediaSampleGStreamer::offsetTimestampsBy(const MediaTime& timestampOffset)
+{
+    if (!timestampOffset)
+        return;
+    m_pts += timestampOffset;
+    m_dts += timestampOffset;
+    if (auto* buffer = gst_sample_get_buffer(m_sample.get())) {
+        GST_BUFFER_PTS(buffer) = toGstClockTime(m_pts);
+        GST_BUFFER_DTS(buffer) = toGstClockTime(m_dts);
+    }
+}
+
+PlatformSample MediaSampleGStreamer::platformSample()
+{
+    PlatformSample sample = { PlatformSample::GStreamerSampleType, { .gstSample = m_sample.get() } };
+    return sample;
+}
+
+Ref<MediaSample> MediaSampleGStreamer::createNonDisplayingCopy() const
+{
+    if (!m_sample)
+        return createFakeSample(nullptr, m_pts, m_dts, m_duration, m_presentationSize, m_trackId);
+
+    GstBuffer* buffer = gst_sample_get_buffer(m_sample.get());
+    GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_DECODE_ONLY);
+
+    GstCaps* caps = gst_sample_get_caps(m_sample.get());
+    GstSegment* segment = gst_sample_get_segment(m_sample.get());
+    const GstStructure* originalInfo = gst_sample_get_info(m_sample.get());
+    GstStructure* info = originalInfo ? gst_structure_copy(originalInfo) : nullptr;
+    GRefPtr<GstSample> sample = adoptGRef(gst_sample_new(buffer, caps, segment, info));
+
+    return adoptRef(*new MediaSampleGStreamer(sample.get(), m_presentationSize, m_trackId));
+}
+
+} // namespace WebCore.
+
+#endif // ENABLE(VIDEO) && USE(GSTREAMER)

Copied: trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h (from rev 226356, trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h) (0 => 226357)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h	2018-01-03 10:58:21 UTC (rev 226357)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 Metrological Group B.V.
+ * Copyright (C) 2016, 2017, 2018 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * aint with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+
+#include "FloatSize.h"
+#include "GRefPtrGStreamer.h"
+#include "MediaSample.h"
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class MediaSampleGStreamer final : public MediaSample {
+public:
+    static Ref<MediaSampleGStreamer> create(GRefPtr<GstSample>&& sample, const FloatSize& presentationSize, const AtomicString& trackId)
+    {
+        return adoptRef(*new MediaSampleGStreamer(WTFMove(sample), presentationSize, trackId));
+    }
+
+    static Ref<MediaSampleGStreamer> createFakeSample(GstCaps*, MediaTime pts, MediaTime dts, MediaTime duration, const FloatSize& presentationSize, const AtomicString& trackId);
+
+    void applyPtsOffset(MediaTime);
+    MediaTime presentationTime() const override { return m_pts; }
+    MediaTime decodeTime() const override { return m_dts; }
+    MediaTime duration() const override { return m_duration; }
+    AtomicString trackID() const override { return m_trackId; }
+    void setTrackID(const String& trackId) override { m_trackId = trackId; }
+    size_t sizeInBytes() const override { return m_size; }
+    FloatSize presentationSize() const override { return m_presentationSize; }
+    void offsetTimestampsBy(const MediaTime&) override;
+    void setTimestamps(const MediaTime&, const MediaTime&) override { }
+    bool isDivisable() const override { return false; }
+    std::pair<RefPtr<MediaSample>, RefPtr<MediaSample>> divide(const MediaTime&) override  { return { nullptr, nullptr }; }
+    Ref<MediaSample> createNonDisplayingCopy() const override;
+    SampleFlags flags() const override { return m_flags; }
+    PlatformSample platformSample() override;
+    void dump(PrintStream&) const override { }
+
+private:
+    MediaSampleGStreamer(GRefPtr<GstSample>&&, const FloatSize& presentationSize, const AtomicString& trackId);
+    MediaSampleGStreamer(const FloatSize& presentationSize, const AtomicString& trackId);
+    virtual ~MediaSampleGStreamer() = default;
+
+    MediaTime m_pts;
+    MediaTime m_dts;
+    MediaTime m_duration;
+    AtomicString m_trackId;
+    size_t m_size { 0 };
+    GRefPtr<GstSample> m_sample;
+    FloatSize m_presentationSize;
+    MediaSample::SampleFlags m_flags { MediaSample::IsSync };
+};
+
+} // namespace WebCore.
+
+#endif // ENABLE(VIDEO) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (226356 => 226357)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp	2018-01-03 10:58:21 UTC (rev 226357)
@@ -27,7 +27,7 @@
 #include "GRefPtrGStreamer.h"
 #include "GStreamerEMEUtilities.h"
 #include "GStreamerMediaDescription.h"
-#include "GStreamerMediaSample.h"
+#include "MediaSampleGStreamer.h"
 #include "InbandTextTrackPrivateGStreamer.h"
 #include "MediaDescription.h"
 #include "SourceBufferPrivateGStreamer.h"
@@ -726,7 +726,7 @@
             return;
         }
 
-        RefPtr<GStreamerMediaSample> mediaSample = WebCore::GStreamerMediaSample::create(sample, m_presentationSize, trackId());
+        RefPtr<MediaSampleGStreamer> mediaSample = WebCore::MediaSampleGStreamer::create(sample, m_presentationSize, trackId());
 
         GST_TRACE("append: trackId=%s PTS=%s DTS=%s DUR=%s presentationSize=%.0fx%.0f",
             mediaSample->trackID().string().utf8().data(),

Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp (226356 => 226357)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp	2018-01-03 10:58:21 UTC (rev 226357)
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2016 Metrological Group B.V.
- * Copyright (C) 2016 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "GStreamerMediaSample.h"
-
-#include "GStreamerUtilities.h"
-
-#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
-
-namespace WebCore {
-
-GStreamerMediaSample::GStreamerMediaSample(GstSample* sample, const FloatSize& presentationSize, const AtomicString& trackId)
-    : MediaSample()
-    , m_pts(MediaTime::zeroTime())
-    , m_dts(MediaTime::zeroTime())
-    , m_duration(MediaTime::zeroTime())
-    , m_trackId(trackId)
-    , m_size(0)
-    , m_presentationSize(presentationSize)
-    , m_flags(MediaSample::IsSync)
-{
-
-    if (!sample)
-        return;
-
-    GstBuffer* buffer = gst_sample_get_buffer(sample);
-    if (!buffer)
-        return;
-
-    auto createMediaTime =
-        [](GstClockTime time) -> MediaTime {
-            return MediaTime(GST_TIME_AS_USECONDS(time), G_USEC_PER_SEC);
-        };
-
-    if (GST_BUFFER_PTS_IS_VALID(buffer))
-        m_pts = createMediaTime(GST_BUFFER_PTS(buffer));
-    if (GST_BUFFER_DTS_IS_VALID(buffer) || GST_BUFFER_PTS_IS_VALID(buffer))
-        m_dts = createMediaTime(GST_BUFFER_DTS_OR_PTS(buffer));
-    if (GST_BUFFER_DURATION_IS_VALID(buffer))
-        m_duration = createMediaTime(GST_BUFFER_DURATION(buffer));
-
-    m_size = gst_buffer_get_size(buffer);
-    m_sample = sample;
-
-    if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT))
-        m_flags = MediaSample::None;
-
-    if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DECODE_ONLY))
-        m_flags = static_cast<MediaSample::SampleFlags>(m_flags | MediaSample::IsNonDisplaying);
-}
-
-Ref<GStreamerMediaSample> GStreamerMediaSample::createFakeSample(GstCaps*, MediaTime pts, MediaTime dts, MediaTime duration, const FloatSize& presentationSize, const AtomicString& trackId)
-{
-    GStreamerMediaSample* gstreamerMediaSample = new GStreamerMediaSample(nullptr, presentationSize, trackId);
-    gstreamerMediaSample->m_pts = pts;
-    gstreamerMediaSample->m_dts = dts;
-    gstreamerMediaSample->m_duration = duration;
-    gstreamerMediaSample->m_flags = MediaSample::IsNonDisplaying;
-    return adoptRef(*gstreamerMediaSample);
-}
-
-void GStreamerMediaSample::applyPtsOffset(MediaTime timestampOffset)
-{
-    if (m_pts > timestampOffset) {
-        m_duration = m_duration + (m_pts - timestampOffset);
-        m_pts = timestampOffset;
-    }
-}
-
-void GStreamerMediaSample::offsetTimestampsBy(const MediaTime& timestampOffset)
-{
-    if (!timestampOffset)
-        return;
-    m_pts += timestampOffset;
-    m_dts += timestampOffset;
-    GstBuffer* buffer = gst_sample_get_buffer(m_sample.get());
-    if (buffer) {
-        GST_BUFFER_PTS(buffer) = toGstClockTime(m_pts);
-        GST_BUFFER_DTS(buffer) = toGstClockTime(m_dts);
-    }
-}
-
-Ref<MediaSample> GStreamerMediaSample::createNonDisplayingCopy() const
-{
-    if (!m_sample)
-        return createFakeSample(nullptr, m_pts, m_dts, m_duration, m_presentationSize, m_trackId);
-
-    GstBuffer* buffer = gst_sample_get_buffer(m_sample.get());
-    GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_DECODE_ONLY);
-
-    GstCaps* caps = gst_sample_get_caps(m_sample.get());
-    GstSegment* segment = gst_sample_get_segment(m_sample.get());
-    const GstStructure* originalInfo = gst_sample_get_info(m_sample.get());
-    GstStructure* info = originalInfo ? gst_structure_copy(originalInfo) : nullptr;
-    GRefPtr<GstSample> sample = adoptGRef(gst_sample_new(buffer, caps, segment, info));
-
-    return adoptRef(*new GStreamerMediaSample(sample.get(), m_presentationSize, m_trackId));
-}
-
-} // namespace WebCore.
-
-#endif // USE(GSTREAMER)

Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h (226356 => 226357)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h	2018-01-03 10:58:21 UTC (rev 226357)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2016 Metrological Group B.V.
- * Copyright (C) 2016 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
-
-#include "FloatSize.h"
-#include "GRefPtrGStreamer.h"
-#include "MediaSample.h"
-#include <gst/gst.h>
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-class GStreamerMediaSample : public MediaSample {
-public:
-    static Ref<GStreamerMediaSample> create(GstSample* sample, const FloatSize& presentationSize, const AtomicString& trackId)
-    {
-        return adoptRef(*new GStreamerMediaSample(sample, presentationSize, trackId));
-    }
-
-    static Ref<GStreamerMediaSample> createFakeSample(GstCaps*, MediaTime pts, MediaTime dts, MediaTime duration, const FloatSize& presentationSize, const AtomicString& trackId);
-
-    void applyPtsOffset(MediaTime);
-    MediaTime presentationTime() const override { return m_pts; }
-    MediaTime decodeTime() const override { return m_dts; }
-    MediaTime duration() const override { return m_duration; }
-    AtomicString trackID() const override { return m_trackId; }
-    void setTrackID(const String& trackId) override { m_trackId = trackId; }
-    size_t sizeInBytes() const override { return m_size; }
-    GstSample* sample() const { return m_sample.get(); }
-    FloatSize presentationSize() const override { return m_presentationSize; }
-    void offsetTimestampsBy(const MediaTime&) override;
-    void setTimestamps(const MediaTime&, const MediaTime&) override { }
-    bool isDivisable() const override { return false; }
-    std::pair<RefPtr<MediaSample>, RefPtr<MediaSample>> divide(const MediaTime&) override  { return { nullptr, nullptr }; }
-    Ref<MediaSample> createNonDisplayingCopy() const override;
-    SampleFlags flags() const override { return m_flags; }
-    PlatformSample platformSample() override  { return PlatformSample(); }
-    void dump(PrintStream&) const override { }
-
-private:
-    GStreamerMediaSample(GstSample*, const FloatSize& presentationSize, const AtomicString& trackId);
-    virtual ~GStreamerMediaSample() = default;
-
-    MediaTime m_pts;
-    MediaTime m_dts;
-    MediaTime m_duration;
-    AtomicString m_trackId;
-    size_t m_size;
-    GRefPtr<GstSample> m_sample;
-    FloatSize m_presentationSize;
-    MediaSample::SampleFlags m_flags;
-};
-
-} // namespace WebCore.
-
-#endif // USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp (226356 => 226357)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp	2018-01-03 10:05:06 UTC (rev 226356)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp	2018-01-03 10:58:21 UTC (rev 226357)
@@ -25,7 +25,7 @@
 #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
 
 #include "AudioTrackPrivateGStreamer.h"
-#include "GStreamerMediaSample.h"
+#include "MediaSampleGStreamer.h"
 #include "GStreamerUtilities.h"
 #include "GUniquePtrGStreamer.h"
 #include "MediaSample.h"
@@ -501,11 +501,11 @@
     // Only modified by the main thread, no need to lock.
     MediaTime lastEnqueuedTime = stream->lastEnqueuedTime;
 
-    GStreamerMediaSample* sample = static_cast<GStreamerMediaSample*>(mediaSample.ptr());
-    if (sample->sample() && gst_sample_get_buffer(sample->sample())) {
-        GRefPtr<GstSample> gstSample = sample->sample();
+    ASSERT(mediaSample->platformSample().type == PlatformSample::GStreamerSampleType);
+    GRefPtr<GstSample> gstSample = mediaSample->platformSample().sample.gstSample;
+    if (gstSample && gst_sample_get_buffer(gstSample.get())) {
         GstBuffer* buffer = gst_sample_get_buffer(gstSample.get());
-        lastEnqueuedTime = sample->presentationTime();
+        lastEnqueuedTime = mediaSample->presentationTime();
 
         GST_BUFFER_FLAG_UNSET(buffer, GST_BUFFER_FLAG_DECODE_ONLY);
         pushSample(GST_APP_SRC(appsrc), gstSample.get());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to