Changeset 207880 in webkit
- Timestamp:
- Oct 26, 2016, 1:41:16 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207879 r207880 1 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> 2 3 [GStreamer][MSE] MediaSourceGStreamer refactoring 4 https://bugs.webkit.org/show_bug.cgi?id=162899 5 6 Reviewed by Žan Doberšek. 7 8 Move MediaSourceGStreamer to the mse directory, manage SourceBufferPrivates and delegate WebKitMediaSrc operations to the MSE private player. 9 10 * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp. 11 (WebCore::MediaSourceGStreamer::open): 12 (WebCore::MediaSourceGStreamer::MediaSourceGStreamer): 13 (WebCore::MediaSourceGStreamer::~MediaSourceGStreamer): 14 (WebCore::MediaSourceGStreamer::addSourceBuffer): 15 (WebCore::MediaSourceGStreamer::removeSourceBuffer): 16 (WebCore::MediaSourceGStreamer::durationChanged): 17 (WebCore::MediaSourceGStreamer::markEndOfStream): 18 (WebCore::MediaSourceGStreamer::unmarkEndOfStream): 19 (WebCore::MediaSourceGStreamer::readyState): 20 (WebCore::MediaSourceGStreamer::setReadyState): 21 (WebCore::MediaSourceGStreamer::waitForSeekCompleted): 22 (WebCore::MediaSourceGStreamer::seekCompleted): 23 (WebCore::MediaSourceGStreamer::sourceBufferPrivateDidChangeActiveState): 24 (WebCore::MediaSourceGStreamer::buffered): 25 * platform/graphics/gstreamer/mse/MediaSourceGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.h. 26 1 27 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> 2 28 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp
r207879 r207880 3 3 * Copyright (C) 2013 Orange 4 4 * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> 5 * Copyright (C) 2015, 2016 Metrological Group B.V. 6 * Copyright (C) 2015, 2016 Igalia, S.L 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 36 38 #if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER) 37 39 40 #include "ContentType.h" 41 #include "MediaPlayerPrivateGStreamer.h" 42 #include "MediaPlayerPrivateGStreamerMSE.h" 43 #include "MediaSourceClientGStreamerMSE.h" 38 44 #include "NotImplemented.h" 39 45 #include "SourceBufferPrivateGStreamer.h" 46 #include "TimeRanges.h" 40 47 #include "WebKitMediaSourceGStreamer.h" 41 48 #include <wtf/PassRefPtr.h> 42 49 #include <wtf/glib/GRefPtr.h> 43 50 44 51 namespace WebCore { 45 52 46 void MediaSourceGStreamer::open(MediaSourcePrivateClient * mediaSource, WebKitMediaSrc* src)53 void MediaSourceGStreamer::open(MediaSourcePrivateClient& mediaSource, MediaPlayerPrivateGStreamerMSE& playerPrivate) 47 54 { 48 ASSERT(mediaSource); 49 mediaSource->setPrivateAndOpen(adoptRef(*new MediaSourceGStreamer(mediaSource, src))); 55 mediaSource.setPrivateAndOpen(adoptRef(*new MediaSourceGStreamer(mediaSource, playerPrivate))); 50 56 } 51 57 52 MediaSourceGStreamer::MediaSourceGStreamer(MediaSourcePrivateClient* mediaSource, WebKitMediaSrc* src) 53 : m_client(adoptRef(new MediaSourceClientGStreamer(src))) 58 MediaSourceGStreamer::MediaSourceGStreamer(MediaSourcePrivateClient& mediaSource, MediaPlayerPrivateGStreamerMSE& playerPrivate) 59 : MediaSourcePrivate() 60 , m_client(MediaSourceClientGStreamerMSE::create(playerPrivate)) 54 61 , m_mediaSource(mediaSource) 55 , m_ readyState(MediaPlayer::HaveNothing)62 , m_playerPrivate(playerPrivate) 56 63 { 57 ASSERT(m_client);58 64 } 59 65 60 66 MediaSourceGStreamer::~MediaSourceGStreamer() 61 67 { 68 for (auto& sourceBufferPrivate : m_sourceBuffers) 69 sourceBufferPrivate->clearMediaSource(); 62 70 } 63 71 64 72 MediaSourceGStreamer::AddStatus MediaSourceGStreamer::addSourceBuffer(const ContentType& contentType, RefPtr<SourceBufferPrivate>& sourceBufferPrivate) 65 73 { 66 RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivateGStreamer = SourceBufferPrivateGStreamer::create(*m_client, contentType); 67 sourceBufferPrivate = sourceBufferPrivateGStreamer; 74 sourceBufferPrivate = SourceBufferPrivateGStreamer::create(this, m_client.get(), contentType); 75 RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivateGStreamer = static_cast<SourceBufferPrivateGStreamer*>(sourceBufferPrivate.get()); 76 m_sourceBuffers.add(sourceBufferPrivateGStreamer); 68 77 return m_client->addSourceBuffer(sourceBufferPrivateGStreamer, contentType); 78 } 79 80 void MediaSourceGStreamer::removeSourceBuffer(SourceBufferPrivate* sourceBufferPrivate) 81 { 82 RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivateGStreamer = static_cast<SourceBufferPrivateGStreamer*>(sourceBufferPrivate); 83 ASSERT(m_sourceBuffers.contains(sourceBufferPrivateGStreamer)); 84 85 sourceBufferPrivateGStreamer->clearMediaSource(); 86 m_sourceBuffers.remove(sourceBufferPrivateGStreamer); 87 m_activeSourceBuffers.remove(sourceBufferPrivateGStreamer.get()); 69 88 } 70 89 … … 86 105 MediaPlayer::ReadyState MediaSourceGStreamer::readyState() const 87 106 { 88 return m_ readyState;107 return m_playerPrivate.readyState(); 89 108 } 90 109 91 110 void MediaSourceGStreamer::setReadyState(MediaPlayer::ReadyState state) 92 111 { 93 m_ readyState = state;112 m_playerPrivate.setReadyState(state); 94 113 } 95 114 96 115 void MediaSourceGStreamer::waitForSeekCompleted() 97 116 { 98 notImplemented();117 m_playerPrivate.waitForSeekCompleted(); 99 118 } 100 119 101 120 void MediaSourceGStreamer::seekCompleted() 102 121 { 103 notImplemented(); 122 m_playerPrivate.seekCompleted(); 123 } 124 125 void MediaSourceGStreamer::sourceBufferPrivateDidChangeActiveState(SourceBufferPrivateGStreamer* sourceBufferPrivate, bool isActive) 126 { 127 if (!isActive) 128 m_activeSourceBuffers.remove(sourceBufferPrivate); 129 else if (!m_activeSourceBuffers.contains(sourceBufferPrivate)) 130 m_activeSourceBuffers.add(sourceBufferPrivate); 131 } 132 133 std::unique_ptr<PlatformTimeRanges> MediaSourceGStreamer::buffered() 134 { 135 return m_mediaSource->buffered(); 104 136 } 105 137 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.h
r207879 r207880 3 3 * Copyright (C) 2013 Orange 4 4 * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> 5 * Copyright (C) 2015, 2016 Metrological Group B.V. 6 * Copyright (C) 2015, 2016 Igalia, S.L 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 31 33 */ 32 34 33 #ifndef MediaSourceGStreamer_h 34 #define MediaSourceGStreamer_h 35 #pragma once 35 36 36 37 #if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER) 37 #include "MediaSource.h" 38 #include "WebKitMediaSourceGStreamer.h" 38 #include "MediaSourcePrivate.h" 39 40 #include <wtf/Forward.h> 41 #include <wtf/HashSet.h> 42 43 typedef struct _WebKitMediaSrc WebKitMediaSrc; 39 44 40 45 namespace WebCore { 46 47 class SourceBufferPrivateGStreamer; 48 class MediaSourceClientGStreamerMSE; 49 class MediaPlayerPrivateGStreamerMSE; 50 class PlatformTimeRanges; 41 51 42 52 // FIXME: Should this be called MediaSourcePrivateGStreamer? 43 53 class MediaSourceGStreamer final : public MediaSourcePrivate { 44 54 public: 45 static void open(MediaSourcePrivateClient *, WebKitMediaSrc*);55 static void open(MediaSourcePrivateClient&, MediaPlayerPrivateGStreamerMSE&); 46 56 virtual ~MediaSourceGStreamer(); 47 57 48 virtual AddStatus addSourceBuffer(const ContentType&, RefPtr<SourceBufferPrivate>&); 49 virtual void durationChanged(); 50 virtual void markEndOfStream(EndOfStreamStatus); 51 virtual void unmarkEndOfStream(); 58 MediaSourceClientGStreamerMSE& client() { return m_client.get(); } 59 AddStatus addSourceBuffer(const ContentType&, RefPtr<SourceBufferPrivate>&) override; 60 void removeSourceBuffer(SourceBufferPrivate*); 52 61 53 virtual MediaPlayer::ReadyState readyState() const; 54 virtual void setReadyState(MediaPlayer::ReadyState); 62 void durationChanged() override; 63 void markEndOfStream(EndOfStreamStatus) override; 64 void unmarkEndOfStream() override; 55 65 56 virtual void waitForSeekCompleted(); 57 virtual void seekCompleted(); 66 MediaPlayer::ReadyState readyState() const override; 67 void setReadyState(MediaPlayer::ReadyState) override; 68 69 void waitForSeekCompleted() override; 70 void seekCompleted() override; 71 72 void sourceBufferPrivateDidChangeActiveState(SourceBufferPrivateGStreamer*, bool); 73 74 std::unique_ptr<PlatformTimeRanges> buffered(); 58 75 59 76 private: 60 MediaSourceGStreamer(MediaSourcePrivateClient *, WebKitMediaSrc*);77 MediaSourceGStreamer(MediaSourcePrivateClient&, MediaPlayerPrivateGStreamerMSE&); 61 78 62 RefPtr<MediaSourceClientGStreamer> m_client; 63 MediaSourcePrivateClient* m_mediaSource; 64 MediaPlayer::ReadyState m_readyState; 79 HashSet<RefPtr<SourceBufferPrivateGStreamer>> m_sourceBuffers; 80 HashSet<SourceBufferPrivateGStreamer*> m_activeSourceBuffers; 81 Ref<MediaSourceClientGStreamerMSE> m_client; 82 Ref<MediaSourcePrivateClient> m_mediaSource; 83 MediaPlayerPrivateGStreamerMSE& m_playerPrivate; 65 84 }; 66 85 … … 68 87 69 88 #endif 70 #endif
Note:
See TracChangeset
for help on using the changeset viewer.