WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-162896-20161025175930.patch (text/plain), 11.10 KB, created by
Enrique Ocaña
on 2016-10-25 11:03:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Enrique Ocaña
Created:
2016-10-25 11:03:17 PDT
Size:
11.10 KB
patch
obsolete
>Subversion Revision: 207816 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 534f5fa5c8c998be8ca72a46bc669ddd9ded9fb6..f9d3c2d448e6aa563644ee3bcb047152a86e623a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,5 +1,32 @@ > 2016-10-04 Enrique Ocaña González <eocanha@igalia.com> > >+ [GStreamer][MSE] MediaSourceClientGStreamerMSE >+ https://bugs.webkit.org/show_bug.cgi?id=162896 >+ >+ Reviewed by Xabier Rodriguez-Calvar. >+ >+ This class encapsulates the MediaSource interaction responsibility for the >+ GStreamer platform. >+ >+ * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: Added. >+ (WebCore::MediaSourceClientGStreamerMSE::create): >+ (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE): >+ (WebCore::MediaSourceClientGStreamerMSE::~MediaSourceClientGStreamerMSE): >+ (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer): >+ (WebCore::MediaSourceClientGStreamerMSE::duration): >+ (WebCore::MediaSourceClientGStreamerMSE::durationChanged): >+ (WebCore::MediaSourceClientGStreamerMSE::abort): >+ (WebCore::MediaSourceClientGStreamerMSE::append): >+ (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream): >+ (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource): >+ (WebCore::MediaSourceClientGStreamerMSE::flushAndEnqueueNonDisplayingSamples): >+ (WebCore::MediaSourceClientGStreamerMSE::enqueueSample): >+ (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc): >+ (WebCore::MediaSourceClientGStreamerMSE::clearPlayerPrivate): >+ * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Added. >+ >+2016-10-04 Enrique Ocaña González <eocanha@igalia.com> >+ > [GStreamer] GStreamer Media Sample > https://bugs.webkit.org/show_bug.cgi?id=162894 > >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..96fc65b9ebebc7ab977bbbefe18a3315f41421f9 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp >@@ -0,0 +1,195 @@ >+/* >+ * 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 "MediaSourceClientGStreamerMSE.h" >+ >+#include "AppendPipeline.h" >+#include "MediaPlayerPrivateGStreamerMSE.h" >+#include "WebKitMediaSourceGStreamer.h" >+ >+#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE) >+ >+namespace WebCore { >+ >+Ref<MediaSourceClientGStreamerMSE> MediaSourceClientGStreamerMSE::create(MediaPlayerPrivateGStreamerMSE& playerPrivate) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ // No return adoptRef(new MediaSourceClientGStreamerMSE(playerPrivate)) because the ownership has already been transferred to MediaPlayerPrivateGStreamerMSE. >+ Ref<MediaSourceClientGStreamerMSE> client(adoptRef(*new MediaSourceClientGStreamerMSE(playerPrivate))); >+ playerPrivate.setMediaSourceClient(client.get()); >+ return client; >+} >+ >+MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE(MediaPlayerPrivateGStreamerMSE& playerPrivate) >+ : m_playerPrivate(&playerPrivate) >+ , m_duration(MediaTime::invalidTime()) >+{ >+ ASSERT(WTF::isMainThread()); >+} >+ >+MediaSourceClientGStreamerMSE::~MediaSourceClientGStreamerMSE() >+{ >+ ASSERT(WTF::isMainThread()); >+} >+ >+MediaSourcePrivate::AddStatus MediaSourceClientGStreamerMSE::addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, const ContentType&) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ if (!m_playerPrivate) >+ return MediaSourcePrivate::AddStatus::NotSupported; >+ >+ 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); >+} >+ >+const MediaTime& MediaSourceClientGStreamerMSE::duration() >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ return m_duration; >+} >+ >+void MediaSourceClientGStreamerMSE::durationChanged(const MediaTime& duration) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ GST_TRACE("duration: %f", duration.toFloat()); >+ if (!duration.isValid() || duration.isPositiveInfinite() || duration.isNegativeInfinite()) >+ return; >+ >+ m_duration = duration; >+ if (m_playerPrivate) >+ m_playerPrivate->durationChanged(); >+} >+ >+void MediaSourceClientGStreamerMSE::abort(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ GST_DEBUG("aborting"); >+ >+ if (!m_playerPrivate) >+ return; >+ >+ RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate); >+ >+ ASSERT(appendPipeline); >+ >+ appendPipeline->abort(); >+} >+ >+bool MediaSourceClientGStreamerMSE::append(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, const unsigned char* data, unsigned length) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ GST_DEBUG("Appending %u bytes", length); >+ >+ if (!m_playerPrivate) >+ return false; >+ >+ RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate); >+ >+ ASSERT(appendPipeline); >+ >+ GstBuffer* buffer = gst_buffer_new_and_alloc(length); >+ gst_buffer_fill(buffer, 0, data, length); >+ >+ return appendPipeline->pushNewBuffer(buffer) == GST_FLOW_OK; >+} >+ >+void MediaSourceClientGStreamerMSE::markEndOfStream(MediaSourcePrivate::EndOfStreamStatus status) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ if (!m_playerPrivate) >+ return; >+ >+ m_playerPrivate->markEndOfStream(status); >+} >+ >+void MediaSourceClientGStreamerMSE::removedFromMediaSource(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ if (!m_playerPrivate) >+ return; >+ >+ ASSERT(m_playerPrivate->m_playbackPipeline); >+ >+ RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate); >+ >+ ASSERT(appendPipeline); >+ >+ appendPipeline->clearPlayerPrivate(); >+ m_playerPrivate->m_appendPipelinesMap.remove(sourceBufferPrivate); >+ // AppendPipeline destructor will take care of cleaning up when appropriate. >+ >+ m_playerPrivate->m_playbackPipeline->removeSourceBuffer(sourceBufferPrivate); >+} >+ >+void MediaSourceClientGStreamerMSE::flush(AtomicString trackId) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ if (m_playerPrivate) >+ m_playerPrivate->m_playbackPipeline->flush(trackId); >+} >+ >+void MediaSourceClientGStreamerMSE::enqueueSample(PassRefPtr<MediaSample> prpSample) >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ if (m_playerPrivate) >+ m_playerPrivate->m_playbackPipeline->enqueueSample(prpSample); >+} >+ >+GRefPtr<WebKitMediaSrc> MediaSourceClientGStreamerMSE::webKitMediaSrc() >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ if (!m_playerPrivate) >+ return nullptr; >+ >+ WebKitMediaSrc* source = WEBKIT_MEDIA_SRC(m_playerPrivate->m_source.get()); >+ >+ ASSERT(WEBKIT_IS_MEDIA_SRC(source)); >+ >+ return source; >+} >+ >+void MediaSourceClientGStreamerMSE::clearPlayerPrivate() >+{ >+ ASSERT(WTF::isMainThread()); >+ >+ m_playerPrivate = nullptr; >+} >+ >+} // namespace WebCore. >+ >+#endif // USE(GSTREAMER) >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h >new file mode 100644 >index 0000000000000000000000000000000000000000..618736b3ce3c8831ce21fb6e503317f4ab3c52b8 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h >@@ -0,0 +1,69 @@ >+/* >+ * 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 "GRefPtrGStreamer.h" >+#include "MediaSourcePrivate.h" >+#include "MediaSourcePrivateClient.h" >+#include "WebKitMediaSourceGStreamer.h" >+#include <wtf/MediaTime.h> >+ >+namespace WebCore { >+ >+class ContentType; >+class MediaPlayerPrivateGStreamerMSE; >+class MediaSample; >+class SourceBufferPrivateGStreamer; >+ >+class MediaSourceClientGStreamerMSE : public RefCounted<MediaSourceClientGStreamerMSE> { >+public: >+ static Ref<MediaSourceClientGStreamerMSE> create(MediaPlayerPrivateGStreamerMSE&); >+ virtual ~MediaSourceClientGStreamerMSE(); >+ >+ // From MediaSourceGStreamer. >+ MediaSourcePrivate::AddStatus addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer>, const ContentType&); >+ void durationChanged(const MediaTime&); >+ void markEndOfStream(MediaSourcePrivate::EndOfStreamStatus); >+ >+ // From SourceBufferPrivateGStreamer. >+ void abort(RefPtr<SourceBufferPrivateGStreamer>); >+ bool append(RefPtr<SourceBufferPrivateGStreamer>, const unsigned char*, unsigned); >+ void removedFromMediaSource(RefPtr<SourceBufferPrivateGStreamer>); >+ void flush(AtomicString); >+ void enqueueSample(PassRefPtr<MediaSample>); >+ >+ void clearPlayerPrivate(); >+ >+ const MediaTime& duration(); >+ GRefPtr<WebKitMediaSrc> webKitMediaSrc(); >+ >+private: >+ MediaSourceClientGStreamerMSE(MediaPlayerPrivateGStreamerMSE&); >+ >+ MediaPlayerPrivateGStreamerMSE* m_playerPrivate; >+ MediaTime m_duration; >+}; >+ >+} // namespace WebCore. >+ >+#endif // USE(GSTREAMER)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 162896
:
290589
|
290593
|
291760
|
292252
|
292406
|
292419
|
292779
|
292891