Title: [271078] trunk/Source
Revision
271078
Author
[email protected]
Date
2020-12-23 13:27:44 -0800 (Wed, 23 Dec 2020)

Log Message

[Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages
https://bugs.webkit.org/show_bug.cgi?id=220122

Reviewed by Eric Carlson.

Source/WebCore:

Currently, `SourceBuffer` needs to get the `highestPresentationTimestamp` from `SourceBufferPrivate`, which
is hard to implement synchronously when `SourceBufferPrivate` runs in a different process (e.g., GPU process).
This patch makes `SourceBufferPrivate` push `highestPresentationTimestamp` to `SourceBuffer` when its value
is changed.

This patch also changes some functions of `SourceBufferPrivate` to virtual so that we can override them
in `SourceBufferPrivateRemote`.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::highestPresentationTimestamp const):
(WebCore::SourceBuffer::sourceBufferPrivateHighestPresentationTimestampChanged):
* Modules/mediasource/SourceBuffer.h:
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::updateHighestPresentationTimestamp):
(WebCore::SourceBufferPrivate::removeCodedFrames):
(WebCore::SourceBufferPrivate::didReceiveSample):
(WebCore::SourceBufferPrivate::highestPresentationTimestamp const): Deleted.
* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::setMode):
(WebCore::SourceBufferPrivate::setGroupStartTimestamp):
(WebCore::SourceBufferPrivate::setGroupStartTimestampToEndTimestamp):
(WebCore::SourceBufferPrivate::setShouldGenerateTimestamps):
(WebCore::SourceBufferPrivate::startChangingType):
(WebCore::SourceBufferPrivate::bufferFull const):
(WebCore::SourceBufferPrivate::hasVideo const):
(WebCore::SourceBufferPrivate::timestampOffset const):
* platform/graphics/SourceBufferPrivateClient.h:

Source/WebKit:

Add IPC messages and handlers in `RemoteSourceBufferProxy` to implement the added functions of `SourceBufferPrivateRemote`.
Also add an IPC message to forward the `HighestPresentationTimestampChanged` callback from `RemoteSourceBufferProxy`
to `SourceBufferPrivateRemote`.

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged):
(WebKit::RemoteSourceBufferProxy::setMediaSourceEnded):
(WebKit::RemoteSourceBufferProxy::setMode):
(WebKit::RemoteSourceBufferProxy::startChangingType):
(WebKit::RemoteSourceBufferProxy::removeCodedFrames):
(WebKit::RemoteSourceBufferProxy::setAllTrackBuffersNeedRandomAccess):
(WebKit::RemoteSourceBufferProxy::setGroupStartTimestamp):
(WebKit::RemoteSourceBufferProxy::setGroupStartTimestampToEndTimestamp):
(WebKit::RemoteSourceBufferProxy::setShouldGenerateTimestamps):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* Scripts/webkit/messages.py:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::setMediaSourceEnded):
(WebKit::SourceBufferPrivateRemote::setMode):
(WebKit::SourceBufferPrivateRemote::removeCodedFrames):
(WebKit::SourceBufferPrivateRemote::setAllTrackBuffersNeedRandomAccess):
(WebKit::SourceBufferPrivateRemote::setGroupStartTimestamp):
(WebKit::SourceBufferPrivateRemote::setGroupStartTimestampToEndTimestamp):
(WebKit::SourceBufferPrivateRemote::setShouldGenerateTimestamps):
(WebKit::SourceBufferPrivateRemote::startChangingType):
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateHighestPresentationTimestampChanged):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271077 => 271078)


--- trunk/Source/WebCore/ChangeLog	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebCore/ChangeLog	2020-12-23 21:27:44 UTC (rev 271078)
@@ -1,3 +1,38 @@
+2020-12-23  Peng Liu  <[email protected]>
+
+        [Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages
+        https://bugs.webkit.org/show_bug.cgi?id=220122
+
+        Reviewed by Eric Carlson.
+
+        Currently, `SourceBuffer` needs to get the `highestPresentationTimestamp` from `SourceBufferPrivate`, which
+        is hard to implement synchronously when `SourceBufferPrivate` runs in a different process (e.g., GPU process).
+        This patch makes `SourceBufferPrivate` push `highestPresentationTimestamp` to `SourceBuffer` when its value
+        is changed.
+
+        This patch also changes some functions of `SourceBufferPrivate` to virtual so that we can override them
+        in `SourceBufferPrivateRemote`.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::highestPresentationTimestamp const):
+        (WebCore::SourceBuffer::sourceBufferPrivateHighestPresentationTimestampChanged):
+        * Modules/mediasource/SourceBuffer.h:
+        * platform/graphics/SourceBufferPrivate.cpp:
+        (WebCore::SourceBufferPrivate::updateHighestPresentationTimestamp):
+        (WebCore::SourceBufferPrivate::removeCodedFrames):
+        (WebCore::SourceBufferPrivate::didReceiveSample):
+        (WebCore::SourceBufferPrivate::highestPresentationTimestamp const): Deleted.
+        * platform/graphics/SourceBufferPrivate.h:
+        (WebCore::SourceBufferPrivate::setMode):
+        (WebCore::SourceBufferPrivate::setGroupStartTimestamp):
+        (WebCore::SourceBufferPrivate::setGroupStartTimestampToEndTimestamp):
+        (WebCore::SourceBufferPrivate::setShouldGenerateTimestamps):
+        (WebCore::SourceBufferPrivate::startChangingType):
+        (WebCore::SourceBufferPrivate::bufferFull const):
+        (WebCore::SourceBufferPrivate::hasVideo const):
+        (WebCore::SourceBufferPrivate::timestampOffset const):
+        * platform/graphics/SourceBufferPrivateClient.h:
+
 2020-12-23  Fujii Hironori  <[email protected]>
 
         [WinCairo] Enable WebGL 2

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (271077 => 271078)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2020-12-23 21:27:44 UTC (rev 271078)
@@ -411,7 +411,7 @@
 
 MediaTime SourceBuffer::highestPresentationTimestamp() const
 {
-    return m_private->highestPresentationTimestamp();
+    return m_highestPresentationTimestamp;
 }
 
 void SourceBuffer::readyStateChanged()
@@ -1136,6 +1136,11 @@
         m_source->setDurationInternal(duration);
 }
 
+void SourceBuffer::sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime& timestamp)
+{
+    m_highestPresentationTimestamp = timestamp;
+}
+
 void SourceBuffer::sourceBufferPrivateDidDropSample()
 {
     if (!isRemoved())

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (271077 => 271078)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h	2020-12-23 21:27:44 UTC (rev 271078)
@@ -152,6 +152,7 @@
     void sourceBufferPrivateStreamEndedWithDecodeError() final;
     void sourceBufferPrivateAppendError(bool decodeError) final;
     void sourceBufferPrivateAppendComplete(AppendResult) final;
+    void sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime&) final;
     void sourceBufferPrivateDurationChanged(const MediaTime& duration) final;
     void sourceBufferPrivateDidParseSample(double sampleDuration) final;
     void sourceBufferPrivateDidDropSample() final;
@@ -224,6 +225,7 @@
 
     MediaTime m_appendWindowStart;
     MediaTime m_appendWindowEnd;
+    MediaTime m_highestPresentationTimestamp;
 
     enum AppendStateType { WaitingForSegment, ParsingInitSegment, ParsingMediaSegment };
     AppendStateType m_appendState;

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp (271077 => 271078)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp	2020-12-23 21:27:44 UTC (rev 271078)
@@ -92,7 +92,7 @@
     }
 }
 
-MediaTime SourceBufferPrivate::highestPresentationTimestamp() const
+void SourceBufferPrivate::updateHighestPresentationTimestamp()
 {
     MediaTime highestTime;
     for (auto& trackBuffer : m_trackBufferMap.values()) {
@@ -101,7 +101,13 @@
             continue;
         highestTime = std::max(highestTime, lastSampleIter->first);
     }
-    return highestTime;
+
+    if (m_highestPresentationTimestamp == highestTime)
+        return;
+
+    m_highestPresentationTimestamp = highestTime;
+    if (m_client)
+        m_client->sourceBufferPrivateHighestPresentationTimestampChanged(m_highestPresentationTimestamp);
 }
 
 void SourceBufferPrivate::setBufferedRanges(const PlatformTimeRanges& timeRanges)
@@ -611,6 +617,8 @@
     // 4. If buffer full flag equals true and this object is ready to accept more bytes, then set the buffer full flag to false.
     // No-op
 
+    updateHighestPresentationTimestamp();
+
     LOG(Media, "SourceBuffer::removeCodedFrames(%p) - buffered = %s", this, toString(m_buffered->ranges()).utf8().data());
 }
 
@@ -1249,6 +1257,8 @@
     // duration set to the maximum of the current duration and the group end timestamp.
     if (m_groupEndTimestamp > duration())
         m_client->sourceBufferPrivateDurationChanged(m_groupEndTimestamp);
+
+    updateHighestPresentationTimestamp();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (271077 => 271078)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2020-12-23 21:27:44 UTC (rev 271078)
@@ -75,13 +75,21 @@
 
     virtual bool canSwitchToType(const ContentType&) { return false; }
 
+    virtual void setMediaSourceEnded(bool);
+    virtual void setMode(SourceBufferAppendMode mode) { m_appendMode = mode; }
     virtual void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize);
     virtual void addTrackBuffer(const AtomString& trackId, RefPtr<MediaDescription>&&);
     virtual void resetTrackBuffers();
     virtual void clearTrackBuffers();
+    virtual void setAllTrackBuffersNeedRandomAccess();
+    virtual void setGroupStartTimestamp(const MediaTime& mediaTime) { m_groupStartTimestamp = mediaTime; }
+    virtual void setGroupStartTimestampToEndTimestamp() { m_groupStartTimestamp = m_groupEndTimestamp; }
+    virtual void setShouldGenerateTimestamps(bool flag) { m_shouldGenerateTimestamps = flag; }
     WEBCORE_EXPORT virtual void updateBufferedFromTrackBuffers(bool sourceIsEnded);
+    virtual void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded);
     WEBCORE_EXPORT virtual void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
     virtual void resetTimestampOffsetInTrackBuffers();
+    virtual void startChangingType() { m_pendingInitializationSegmentForChangeType = true; }
     virtual void setTimestampOffset(const MediaTime& timestampOffset) { m_timestampOffset = timestampOffset; }
     virtual void setAppendWindowStart(const MediaTime& appendWindowStart) { m_appendWindowStart = appendWindowStart;}
     virtual void setAppendWindowEnd(const MediaTime& appendWindowEnd) { m_appendWindowEnd = appendWindowEnd; }
@@ -91,21 +99,13 @@
     void setClient(SourceBufferPrivateClient* client) { m_client = client; }
     void setIsAttached(bool flag) { m_isAttached = flag; }
 
+    bool bufferFull() const { return m_bufferFull; }
+
+    // Methods used by MediaSourcePrivate
     bool hasAudio() const { return m_hasAudio; }
     bool hasVideo() const { return m_hasVideo; }
-    bool bufferFull() const { return m_bufferFull; }
 
     MediaTime timestampOffset() const { return m_timestampOffset; }
-    MediaTime highestPresentationTimestamp() const;
-    void startChangingType() { m_pendingInitializationSegmentForChangeType = true; }
-    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded);
-    void setAllTrackBuffersNeedRandomAccess();
-    void setShouldGenerateTimestamps(bool flag) { m_shouldGenerateTimestamps = flag; }
-    void setMode(SourceBufferAppendMode mode) { m_appendMode = mode; }
-    void setGroupStartTimestamp(const MediaTime& mediaTime) { m_groupStartTimestamp = mediaTime; }
-    void setGroupStartTimestampToEndTimestamp() { m_groupStartTimestamp = m_groupEndTimestamp; }
-    uint64_t totalTrackBufferSizeInBytes() const;
-    void setMediaSourceEnded(bool isEnded);
 
     struct TrackBuffer {
         MediaTime lastDecodeTimestamp;
@@ -163,10 +163,12 @@
     WEBCORE_EXPORT void didReceiveInitializationSegment(SourceBufferPrivateClient::InitializationSegment&&, CompletionHandler<void()>&&);
     WEBCORE_EXPORT void didReceiveSample(MediaSample&);
     void provideMediaData(const AtomString& trackID);
+    uint64_t totalTrackBufferSizeInBytes() const;
 
     SourceBufferPrivateClient* m_client { nullptr };
 
 private:
+    void updateHighestPresentationTimestamp();
     void updateMinimumUpcomingPresentationTime(TrackBuffer&, const AtomString& trackID);
     void reenqueueMediaForTime(TrackBuffer&, const AtomString& trackID, const MediaTime&);
     bool validateInitializationSegment(const SourceBufferPrivateClient::InitializationSegment&);
@@ -190,6 +192,7 @@
     MediaTime m_timestampOffset;
     MediaTime m_appendWindowStart { MediaTime::zeroTime() };
     MediaTime m_appendWindowEnd { MediaTime::positiveInfiniteTime() };
+    MediaTime m_highestPresentationTimestamp;
 
     MediaTime m_groupStartTimestamp { MediaTime::invalidTime() };
     MediaTime m_groupEndTimestamp { MediaTime::zeroTime() };
@@ -201,4 +204,16 @@
 
 } // namespace WebCore
 
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::SourceBufferAppendMode> {
+    using values = EnumValues<
+        WebCore::SourceBufferAppendMode,
+        WebCore::SourceBufferAppendMode::Segments,
+        WebCore::SourceBufferAppendMode::Sequence
+    >;
+};
+
+}; // namespace WTF
+
 #endif

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h (271077 => 271078)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h	2020-12-23 21:27:44 UTC (rev 271078)
@@ -74,6 +74,7 @@
     };
     virtual void sourceBufferPrivateAppendComplete(AppendResult) = 0;
     virtual void sourceBufferPrivateDurationChanged(const MediaTime&) = 0;
+    virtual void sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime&) = 0;
     virtual void sourceBufferPrivateDidParseSample(double frameDuration) = 0;
     virtual void sourceBufferPrivateDidDropSample() = 0;
     virtual void sourceBufferPrivateBufferedDirtyChanged(bool) = 0;

Modified: trunk/Source/WebKit/ChangeLog (271077 => 271078)


--- trunk/Source/WebKit/ChangeLog	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/ChangeLog	2020-12-23 21:27:44 UTC (rev 271078)
@@ -1,5 +1,42 @@
 2020-12-23  Peng Liu  <[email protected]>
 
+        [Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages
+        https://bugs.webkit.org/show_bug.cgi?id=220122
+
+        Reviewed by Eric Carlson.
+
+        Add IPC messages and handlers in `RemoteSourceBufferProxy` to implement the added functions of `SourceBufferPrivateRemote`.
+        Also add an IPC message to forward the `HighestPresentationTimestampChanged` callback from `RemoteSourceBufferProxy`
+        to `SourceBufferPrivateRemote`.
+
+        * GPUProcess/media/RemoteSourceBufferProxy.cpp:
+        (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged):
+        (WebKit::RemoteSourceBufferProxy::setMediaSourceEnded):
+        (WebKit::RemoteSourceBufferProxy::setMode):
+        (WebKit::RemoteSourceBufferProxy::startChangingType):
+        (WebKit::RemoteSourceBufferProxy::removeCodedFrames):
+        (WebKit::RemoteSourceBufferProxy::setAllTrackBuffersNeedRandomAccess):
+        (WebKit::RemoteSourceBufferProxy::setGroupStartTimestamp):
+        (WebKit::RemoteSourceBufferProxy::setGroupStartTimestampToEndTimestamp):
+        (WebKit::RemoteSourceBufferProxy::setShouldGenerateTimestamps):
+        * GPUProcess/media/RemoteSourceBufferProxy.h:
+        * GPUProcess/media/RemoteSourceBufferProxy.messages.in:
+        * Scripts/webkit/messages.py:
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
+        (WebKit::SourceBufferPrivateRemote::setMediaSourceEnded):
+        (WebKit::SourceBufferPrivateRemote::setMode):
+        (WebKit::SourceBufferPrivateRemote::removeCodedFrames):
+        (WebKit::SourceBufferPrivateRemote::setAllTrackBuffersNeedRandomAccess):
+        (WebKit::SourceBufferPrivateRemote::setGroupStartTimestamp):
+        (WebKit::SourceBufferPrivateRemote::setGroupStartTimestampToEndTimestamp):
+        (WebKit::SourceBufferPrivateRemote::setShouldGenerateTimestamps):
+        (WebKit::SourceBufferPrivateRemote::startChangingType):
+        (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateHighestPresentationTimestampChanged):
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:
+
+2020-12-23  Peng Liu  <[email protected]>
+
         [Media in GPU Process][MSE] Media element does not fire "resize" event
         https://bugs.webkit.org/show_bug.cgi?id=220119
 

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp (271077 => 271078)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2020-12-23 21:27:44 UTC (rev 271078)
@@ -115,6 +115,11 @@
     m_connectionToWebProcess.connection().send(Messages::SourceBufferPrivateRemote::SourceBufferPrivateAppendError(decodeError), m_identifier);
 }
 
+void RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime& timestamp)
+{
+    m_connectionToWebProcess.connection().send(Messages::SourceBufferPrivateRemote::SourceBufferPrivateHighestPresentationTimestampChanged(timestamp), m_identifier);
+}
+
 void RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged(const MediaTime& duration)
 {
     m_connectionToWebProcess.connection().send(Messages::SourceBufferPrivateRemote::SourceBufferPrivateDurationChanged(duration), m_identifier);
@@ -175,21 +180,41 @@
     m_sourceBufferPrivate->removedFromMediaSource();
 }
 
+void RemoteSourceBufferProxy::setMediaSourceEnded(bool isEnded)
+{
+    m_sourceBufferPrivate->setMediaSourceEnded(isEnded);
+}
+
 void RemoteSourceBufferProxy::setActive(bool active)
 {
     m_sourceBufferPrivate->setActive(active);
 }
 
+void RemoteSourceBufferProxy::setMode(WebCore::SourceBufferAppendMode appendMode)
+{
+    m_sourceBufferPrivate->setMode(appendMode);
+}
+
 void RemoteSourceBufferProxy::setReadyState(WebCore::MediaPlayer::ReadyState state)
 {
     m_sourceBufferPrivate->setReadyState(state);
 }
 
+void RemoteSourceBufferProxy::startChangingType()
+{
+    m_sourceBufferPrivate->startChangingType();
+}
+
 void RemoteSourceBufferProxy::updateBufferedFromTrackBuffers(bool sourceIsEnded)
 {
     m_sourceBufferPrivate->updateBufferedFromTrackBuffers(sourceIsEnded);
 }
 
+void RemoteSourceBufferProxy::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded)
+{
+    m_sourceBufferPrivate->removeCodedFrames(start, end, currentTime, isEnded);
+}
+
 void RemoteSourceBufferProxy::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
 {
     m_sourceBufferPrivate->evictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded);
@@ -212,11 +237,31 @@
     m_sourceBufferPrivate->clearTrackBuffers();
 }
 
+void RemoteSourceBufferProxy::setAllTrackBuffersNeedRandomAccess()
+{
+    m_sourceBufferPrivate->setAllTrackBuffersNeedRandomAccess();
+}
+
 void RemoteSourceBufferProxy::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
 {
     m_sourceBufferPrivate->reenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize);
 }
 
+void RemoteSourceBufferProxy::setGroupStartTimestamp(const MediaTime& timestamp)
+{
+    m_sourceBufferPrivate->setGroupStartTimestamp(timestamp);
+}
+
+void RemoteSourceBufferProxy::setGroupStartTimestampToEndTimestamp()
+{
+    m_sourceBufferPrivate->setGroupStartTimestampToEndTimestamp();
+}
+
+void RemoteSourceBufferProxy::setShouldGenerateTimestamps(bool shouldGenerateTimestamps)
+{
+    m_sourceBufferPrivate->setShouldGenerateTimestamps(shouldGenerateTimestamps);
+}
+
 void RemoteSourceBufferProxy::resetTimestampOffsetInTrackBuffers()
 {
     m_sourceBufferPrivate->resetTimestampOffsetInTrackBuffers();

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h (271077 => 271078)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2020-12-23 21:27:44 UTC (rev 271078)
@@ -70,6 +70,7 @@
     void sourceBufferPrivateStreamEndedWithDecodeError() final;
     void sourceBufferPrivateAppendError(bool decodeError) final;
     void sourceBufferPrivateAppendComplete(WebCore::SourceBufferPrivateClient::AppendResult) final;
+    void sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime&) final;
     void sourceBufferPrivateDurationChanged(const MediaTime&) final;
     void sourceBufferPrivateDidParseSample(double sampleDuration) final;
     void sourceBufferPrivateDidDropSample() final;
@@ -83,17 +84,25 @@
     // void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
 
     void setActive(bool);
+    void setMode(WebCore::SourceBufferAppendMode);
     void append(const IPC::DataReference&);
     void abort();
     void resetParserState();
     void removedFromMediaSource();
+    void setMediaSourceEnded(bool);
     void setReadyState(WebCore::MediaPlayer::ReadyState);
+    void startChangingType();
     void updateBufferedFromTrackBuffers(bool sourceIsEnded);
+    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded);
     void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
     void addTrackBuffer(TrackPrivateRemoteIdentifier);
     void resetTrackBuffers();
     void clearTrackBuffers();
+    void setAllTrackBuffersNeedRandomAccess();
     void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize);
+    void setGroupStartTimestamp(const MediaTime&);
+    void setGroupStartTimestampToEndTimestamp();
+    void setShouldGenerateTimestamps(bool);
     void resetTimestampOffsetInTrackBuffers();
     void setTimestampOffset(const MediaTime&);
     void setAppendWindowStart(const MediaTime&);

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in (271077 => 271078)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2020-12-23 21:27:44 UTC (rev 271078)
@@ -27,17 +27,25 @@
 
 messages -> RemoteSourceBufferProxy NotRefCounted {
     SetActive(bool active)
+    SetMode(WebCore::SourceBufferAppendMode appendMode)
     Append(IPC::DataReference data)
     Abort()
     ResetParserState()
     RemovedFromMediaSource()
+    SetMediaSourceEnded(bool isEnded)
     SetReadyState(WebCore::MediaPlayer::ReadyState state)
+    StartChangingType()
     UpdateBufferedFromTrackBuffers(bool sourceIsEnded)
-    EvictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded)
     AddTrackBuffer(WebKit::TrackPrivateRemoteIdentifier remoteIdentifier)
     ResetTrackBuffers()
     ClearTrackBuffers()
+    SetAllTrackBuffersNeedRandomAccess()
+    RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded)
+    EvictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded)
     ReenqueueMediaIfNeeded(MediaTime currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
+    SetGroupStartTimestamp(MediaTime timestamp)
+    SetGroupStartTimestampToEndTimestamp()
+    SetShouldGenerateTimestamps(bool shouldGenerateTimestamps)
     ResetTimestampOffsetInTrackBuffers()
     SetTimestampOffset(MediaTime timestampOffset)
     SetAppendWindowStart(MediaTime appendWindowStart)

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (271077 => 271078)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2020-12-23 21:27:44 UTC (rev 271078)
@@ -237,6 +237,7 @@
         'WebCore::ServiceWorkerRegistrationIdentifier',
         'WebCore::SharedStringHash',
         'WebCore::SleepDisablerIdentifier',
+        'WebCore::SourceBufferAppendMode',
         'WebCore::SpeechRecognitionConnectionClientIdentifier',
         'WebCore::SWServerConnectionIdentifier',
         'WebCore::WebSocketIdentifier',
@@ -658,6 +659,7 @@
         'WebCore::ShouldAskITP': ['<WebCore/NetworkStorageSession.h>'],
         'WebCore::ShouldNotifyWhenResolved': ['<WebCore/ServiceWorkerTypes.h>'],
         'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'],
+        'WebCore::SourceBufferAppendMode': ['<WebCore/SourceBufferPrivate.h>'],
         'WebCore::StorageAccessPromptWasShown': ['<WebCore/DocumentStorageAccess.h>'],
         'WebCore::StorageAccessScope': ['<WebCore/DocumentStorageAccess.h>'],
         'WebCore::StorageAccessWasGranted': ['<WebCore/DocumentStorageAccess.h>'],

Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp (271077 => 271078)


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2020-12-23 21:27:44 UTC (rev 271078)
@@ -124,6 +124,16 @@
     return false;
 }
 
+void SourceBufferPrivateRemote::setMediaSourceEnded(bool isEnded)
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::SetMediaSourceEnded(isEnded), m_remoteSourceBufferIdentifier);
+}
+
+void SourceBufferPrivateRemote::setMode(SourceBufferAppendMode mode)
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::SetMode(mode), m_remoteSourceBufferIdentifier);
+}
+
 void SourceBufferPrivateRemote::updateBufferedFromTrackBuffers(bool sourceIsEnded)
 {
     if (!m_mediaSourcePrivate)
@@ -132,6 +142,11 @@
     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::UpdateBufferedFromTrackBuffers(sourceIsEnded), m_remoteSourceBufferIdentifier);
 }
 
+void SourceBufferPrivateRemote::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded)
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::RemoveCodedFrames(start, end, currentMediaTime, isEnded), m_remoteSourceBufferIdentifier);
+}
+
 void SourceBufferPrivateRemote::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
 {
     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::EvictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded), m_remoteSourceBufferIdentifier);
@@ -153,6 +168,26 @@
     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::ClearTrackBuffers(), m_remoteSourceBufferIdentifier);
 }
 
+void SourceBufferPrivateRemote::setAllTrackBuffersNeedRandomAccess()
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::SetAllTrackBuffersNeedRandomAccess(), m_remoteSourceBufferIdentifier);
+}
+
+void SourceBufferPrivateRemote::setGroupStartTimestamp(const MediaTime& timestamp)
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::SetGroupStartTimestamp(timestamp), m_remoteSourceBufferIdentifier);
+}
+
+void SourceBufferPrivateRemote::setGroupStartTimestampToEndTimestamp()
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::SetGroupStartTimestampToEndTimestamp(), m_remoteSourceBufferIdentifier);
+}
+
+void SourceBufferPrivateRemote::setShouldGenerateTimestamps(bool shouldGenerateTimestamps)
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::SetShouldGenerateTimestamps(shouldGenerateTimestamps), m_remoteSourceBufferIdentifier);
+}
+
 void SourceBufferPrivateRemote::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
 {
     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::ReenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize), m_remoteSourceBufferIdentifier);
@@ -163,6 +198,11 @@
     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::ResetTimestampOffsetInTrackBuffers(), m_remoteSourceBufferIdentifier);
 }
 
+void SourceBufferPrivateRemote::startChangingType()
+{
+    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::StartChangingType(), m_remoteSourceBufferIdentifier);
+}
+
 void SourceBufferPrivateRemote::setTimestampOffset(const MediaTime& timestampOffset)
 {
     SourceBufferPrivate::setTimestampOffset(timestampOffset);
@@ -262,6 +302,12 @@
         m_client->sourceBufferPrivateAppendComplete(appendResult);
 }
 
+void SourceBufferPrivateRemote::sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime& timestamp)
+{
+    if (m_client)
+        m_client->sourceBufferPrivateHighestPresentationTimestampChanged(timestamp);
+}
+
 void SourceBufferPrivateRemote::sourceBufferPrivateDurationChanged(const MediaTime& duration)
 {
     if (m_client)

Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h (271077 => 271078)


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h	2020-12-23 21:27:44 UTC (rev 271078)
@@ -80,13 +80,21 @@
     WebCore::MediaPlayer::ReadyState readyState() const final;
     void setReadyState(WebCore::MediaPlayer::ReadyState) final;
     bool canSwitchToType(const WebCore::ContentType&) final;
+    void setMediaSourceEnded(bool) final;
+    void setMode(WebCore::SourceBufferAppendMode) final;
     void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize) final;
     void addTrackBuffer(const AtomString& trackId, RefPtr<WebCore::MediaDescription>&&) final;
     void resetTrackBuffers() final;
     void clearTrackBuffers() final;
+    void setAllTrackBuffersNeedRandomAccess() final;
+    void setGroupStartTimestamp(const MediaTime&) final;
+    void setGroupStartTimestampToEndTimestamp() final;
+    void setShouldGenerateTimestamps(bool) final;
     void updateBufferedFromTrackBuffers(bool sourceIsEnded) final;
+    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded) final;
     void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded) final;
     void resetTimestampOffsetInTrackBuffers() final;
+    void startChangingType() final;
     void setTimestampOffset(const MediaTime&) final;
     void setAppendWindowStart(const MediaTime&) final;
     void setAppendWindowEnd(const MediaTime&) final;
@@ -103,6 +111,7 @@
     void sourceBufferPrivateStreamEndedWithDecodeError();
     void sourceBufferPrivateAppendError(bool decodeError);
     void sourceBufferPrivateAppendComplete(WebCore::SourceBufferPrivateClient::AppendResult);
+    void sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime&);
     void sourceBufferPrivateDurationChanged(const MediaTime&);
     void sourceBufferPrivateDidParseSample(double sampleDuration);
     void sourceBufferPrivateDidDropSample();

Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in (271077 => 271078)


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in	2020-12-23 21:20:58 UTC (rev 271077)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in	2020-12-23 21:27:44 UTC (rev 271078)
@@ -30,6 +30,7 @@
     SourceBufferPrivateStreamEndedWithDecodeError()
     SourceBufferPrivateAppendError(bool decodeError)
     SourceBufferPrivateAppendComplete(WebCore::SourceBufferPrivateClient::AppendResult appendResult)
+    SourceBufferPrivateHighestPresentationTimestampChanged(MediaTime timestamp)
     SourceBufferPrivateDurationChanged(MediaTime duration)
     SourceBufferPrivateDidParseSample(double sampleDuration)
     SourceBufferPrivateDidDropSample()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to