Changeset 207879 in webkit
- Timestamp:
- Oct 26, 2016 1:40:33 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207878 r207879 1 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> 2 3 [GStreamer][MSE] SourceBufferPrivateGStreamer refactoring 4 https://bugs.webkit.org/show_bug.cgi?id=162898 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Moved SourceBufferPrivateGStreamer to an mse directory and added unimplemented features (abort, enqueueing and sample flow control). 9 10 * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp: Removed. 11 * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: Added. 12 (WebCore::SourceBufferPrivateGStreamer::create): 13 (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): 14 (WebCore::SourceBufferPrivateGStreamer::~SourceBufferPrivateGStreamer): 15 (WebCore::SourceBufferPrivateGStreamer::setClient): 16 (WebCore::SourceBufferPrivateGStreamer::append): 17 (WebCore::SourceBufferPrivateGStreamer::abort): 18 (WebCore::SourceBufferPrivateGStreamer::resetParserState): 19 (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource): 20 (WebCore::SourceBufferPrivateGStreamer::readyState): 21 (WebCore::SourceBufferPrivateGStreamer::setReadyState): 22 (WebCore::SourceBufferPrivateGStreamer::flushAndEnqueueNonDisplayingSamples): 23 (WebCore::SourceBufferPrivateGStreamer::enqueueSample): 24 (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples): 25 (WebCore::SourceBufferPrivateGStreamer::setReadyForMoreSamples): 26 (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples): 27 (WebCore::SourceBufferPrivateGStreamer::setActive): 28 (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples): 29 (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples): 30 (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment): 31 (WebCore::SourceBufferPrivateGStreamer::didReceiveSample): 32 (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples): 33 * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h. 34 1 35 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> 2 36 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp
r207878 r207879 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 … … 37 39 38 40 #include "ContentType.h" 41 #include "GStreamerUtilities.h" 42 #include "MediaPlayerPrivateGStreamerMSE.h" 43 #include "MediaSample.h" 44 #include "MediaSourceClientGStreamerMSE.h" 45 #include "MediaSourceGStreamer.h" 39 46 #include "NotImplemented.h" 47 #include "WebKitMediaSourceGStreamer.h" 40 48 41 49 namespace WebCore { 42 50 43 Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSource ClientGStreamer&client, const ContentType& contentType)51 Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSourceGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType) 44 52 { 45 return adoptRef(*new SourceBufferPrivateGStreamer( client, contentType));53 return adoptRef(*new SourceBufferPrivateGStreamer(mediaSource, client.get(), contentType)); 46 54 } 47 55 48 SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourceClientGStreamer& client, const ContentType& contentType) 49 : m_type(contentType) 50 , m_client(&client) 51 , m_readyState(MediaPlayer::HaveNothing) 52 { 53 } 54 55 SourceBufferPrivateGStreamer::~SourceBufferPrivateGStreamer() 56 SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourceGStreamer* mediaSource, Ref<MediaSourceClientGStreamerMSE> client, const ContentType& contentType) 57 : SourceBufferPrivate() 58 , m_mediaSource(mediaSource) 59 , m_type(contentType) 60 , m_client(client.get()) 56 61 { 57 62 } … … 64 69 void SourceBufferPrivateGStreamer::append(const unsigned char* data, unsigned length) 65 70 { 66 ASSERT(m_client); 67 ASSERT(m_sourceBufferPrivateClient); 71 ASSERT(m_mediaSource); 68 72 69 SourceBufferPrivateClient::AppendResult result = m_client->append(this, data, length); 70 m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(this, result); 73 if (!m_sourceBufferPrivateClient) 74 return; 75 76 if (m_client->append(this, data, length)) 77 return; 78 79 m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(this, SourceBufferPrivateClient::ReadStreamFailed); 71 80 } 72 81 73 82 void SourceBufferPrivateGStreamer::abort() 74 83 { 75 notImplemented();84 m_client->abort(this); 76 85 } 77 86 … … 83 92 void SourceBufferPrivateGStreamer::removedFromMediaSource() 84 93 { 94 if (m_mediaSource) 95 m_mediaSource->removeSourceBuffer(this); 85 96 m_client->removedFromMediaSource(this); 86 97 } … … 88 99 MediaPlayer::ReadyState SourceBufferPrivateGStreamer::readyState() const 89 100 { 90 return m_ readyState;101 return m_mediaSource->readyState(); 91 102 } 92 103 93 104 void SourceBufferPrivateGStreamer::setReadyState(MediaPlayer::ReadyState state) 94 105 { 95 m_ readyState = state;106 m_mediaSource->setReadyState(state); 96 107 } 97 108 98 // TODO: Implement these 99 void SourceBufferPrivateGStreamer::flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>>, AtomicString) 109 void SourceBufferPrivateGStreamer::flush(AtomicString trackId) 100 110 { 101 notImplemented();111 m_client->flush(trackId); 102 112 } 103 113 104 void SourceBufferPrivateGStreamer::enqueueSample(PassRefPtr<MediaSample> , AtomicString)114 void SourceBufferPrivateGStreamer::enqueueSample(PassRefPtr<MediaSample> prpSample, AtomicString) 105 115 { 106 notImplemented(); 116 m_notifyWhenReadyForMoreSamples = false; 117 118 RefPtr<MediaSample> protectedPrpSample = prpSample; 119 m_client->enqueueSample(protectedPrpSample); 107 120 } 108 121 109 122 bool SourceBufferPrivateGStreamer::isReadyForMoreSamples(AtomicString) 110 123 { 111 notImplemented(); 112 113 return false; 124 return m_isReadyForMoreSamples; 114 125 } 115 126 116 void SourceBufferPrivateGStreamer::set Active(bool)127 void SourceBufferPrivateGStreamer::setReadyForMoreSamples(bool isReady) 117 128 { 118 notImplemented(); 129 ASSERT(WTF::isMainThread()); 130 m_isReadyForMoreSamples = isReady; 131 } 132 133 void SourceBufferPrivateGStreamer::notifyReadyForMoreSamples() 134 { 135 ASSERT(WTF::isMainThread()); 136 setReadyForMoreSamples(true); 137 if (m_notifyWhenReadyForMoreSamples) 138 m_sourceBufferPrivateClient->sourceBufferPrivateDidBecomeReadyForMoreSamples(this, m_trackId); 139 } 140 141 void SourceBufferPrivateGStreamer::setActive(bool isActive) 142 { 143 if (m_mediaSource) 144 m_mediaSource->sourceBufferPrivateDidChangeActiveState(this, isActive); 119 145 } 120 146 … … 124 150 } 125 151 126 void SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples(AtomicString )152 void SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples(AtomicString trackId) 127 153 { 128 notImplemented(); 154 ASSERT(WTF::isMainThread()); 155 m_notifyWhenReadyForMoreSamples = true; 156 m_trackId = trackId; 157 } 158 159 void SourceBufferPrivateGStreamer::didReceiveInitializationSegment(const SourceBufferPrivateClient::InitializationSegment& initializationSegment) 160 { 161 if (m_sourceBufferPrivateClient) 162 m_sourceBufferPrivateClient->sourceBufferPrivateDidReceiveInitializationSegment(this, initializationSegment); 163 } 164 165 void SourceBufferPrivateGStreamer::didReceiveSample(PassRefPtr<MediaSample> prpSample) 166 { 167 RefPtr<MediaSample> protectedPrpSample = prpSample; 168 if (m_sourceBufferPrivateClient) 169 m_sourceBufferPrivateClient->sourceBufferPrivateDidReceiveSample(this, *protectedPrpSample); 170 } 171 172 void SourceBufferPrivateGStreamer::didReceiveAllPendingSamples() 173 { 174 if (m_sourceBufferPrivateClient) 175 m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(this, SourceBufferPrivateClient::AppendSucceeded); 129 176 } 130 177 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h
r207878 r207879 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 SourceBufferPrivateGStreamer_h 34 #define SourceBufferPrivateGStreamer_h 35 #pragma once 35 36 36 37 #if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER) 37 38 38 39 #include "ContentType.h" 40 #include "MediaPlayerPrivateGStreamerMSE.h" 39 41 #include "SourceBufferPrivate.h" 42 #include "SourceBufferPrivateClient.h" 40 43 #include "WebKitMediaSourceGStreamer.h" 41 44 42 45 namespace WebCore { 43 46 47 class MediaSourceGStreamer; 48 44 49 class SourceBufferPrivateGStreamer final : public SourceBufferPrivate { 50 45 51 public: 46 static Ref<SourceBufferPrivateGStreamer> create(MediaSource ClientGStreamer&, const ContentType&);47 virtual ~SourceBufferPrivateGStreamer() ;52 static Ref<SourceBufferPrivateGStreamer> create(MediaSourceGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&); 53 virtual ~SourceBufferPrivateGStreamer() = default; 48 54 49 v irtual void setClient(SourceBufferPrivateClient*);55 void clearMediaSource() { m_mediaSource = nullptr; } 50 56 51 virtual void append(const unsigned char* data, unsigned length); 52 virtual void abort(); 53 virtual void resetParserState(); 54 virtual void removedFromMediaSource(); 57 void setClient(SourceBufferPrivateClient*) override; 58 void append(const unsigned char*, unsigned) override; 59 void abort() override; 60 void resetParserState() override; 61 void removedFromMediaSource() override; 62 MediaPlayer::ReadyState readyState() const override; 63 void setReadyState(MediaPlayer::ReadyState) override; 55 64 56 virtual MediaPlayer::ReadyState readyState() const; 57 virtual void setReadyState(MediaPlayer::ReadyState); 65 void flush(AtomicString) override; 66 void enqueueSample(PassRefPtr<MediaSample>, AtomicString) override; 67 bool isReadyForMoreSamples(AtomicString) override; 68 void setActive(bool) override; 69 void stopAskingForMoreSamples(AtomicString) override; 70 void notifyClientWhenReadyForMoreSamples(AtomicString) override; 58 71 59 v irtual void flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>>, AtomicString);60 v irtual void enqueueSample(PassRefPtr<MediaSample>, AtomicString);61 virtual bool isReadyForMoreSamples(AtomicString); 62 v irtual void setActive(bool);63 v irtual void stopAskingForMoreSamples(AtomicString);64 v irtual void notifyClientWhenReadyForMoreSamples(AtomicString);72 void setReadyForMoreSamples(bool); 73 void notifyReadyForMoreSamples(); 74 75 void didReceiveInitializationSegment(const SourceBufferPrivateClient::InitializationSegment&); 76 void didReceiveSample(PassRefPtr<MediaSample>); 77 void didReceiveAllPendingSamples(); 65 78 66 79 private: 67 SourceBufferPrivateGStreamer(MediaSourceClientGStreamer&, const ContentType&); 80 SourceBufferPrivateGStreamer(MediaSourceGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&); 81 friend class MediaSourceClientGStreamerMSE; 68 82 83 MediaSourceGStreamer* m_mediaSource; 69 84 ContentType m_type; 70 Ref Ptr<MediaSourceClientGStreamer> m_client;85 Ref<MediaSourceClientGStreamerMSE> m_client; 71 86 SourceBufferPrivateClient* m_sourceBufferPrivateClient; 72 MediaPlayer::ReadyState m_readyState; 87 bool m_isReadyForMoreSamples = true; 88 bool m_notifyWhenReadyForMoreSamples = false; 89 AtomicString m_trackId; 73 90 }; 74 91 … … 76 93 77 94 #endif 78 #endif
Note: See TracChangeset
for help on using the changeset viewer.