⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271178 in webkit


Ignore:
Timestamp:
Jan 5, 2021, 3:02:40 PM (6 years ago)
Author:
Peng Liu
Message:

[Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
https://bugs.webkit.org/show_bug.cgi?id=220334

Reviewed by Eric Carlson.

Source/WebCore:

Add a completion handler parameter to SourceBufferPrivate::removeCodedFrames(),
and the caller (SourceBuffer) will fire update and updateend events when
the completion handler is called.

No new tests. Fix failures of the following tests:

  • imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html
  • imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
  • imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html
  • Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::removeTimerFired):

  • platform/graphics/SourceBufferPrivate.cpp:

(WebCore::SourceBufferPrivate::removeCodedFrames):

  • platform/graphics/SourceBufferPrivate.h:

(WebCore::SourceBufferPrivate::removeCodedFrames):

Source/WebKit:

Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement
SourceBufferPrivateRemote::removeCodedFrames().

  • GPUProcess/media/RemoteSourceBufferProxy.cpp:

(WebKit::RemoteSourceBufferProxy::removeCodedFrames):

  • GPUProcess/media/RemoteSourceBufferProxy.h:
  • GPUProcess/media/RemoteSourceBufferProxy.messages.in:
  • WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:

(WebKit::SourceBufferPrivateRemote::removeCodedFrames):

  • WebProcess/GPU/media/SourceBufferPrivateRemote.h:

LayoutTests:

  • gpu-process/TestExpectations:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271166 r271178  
     12021-01-05  Peng Liu  <peng.liu6@apple.com>
     2
     3        [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
     4        https://bugs.webkit.org/show_bug.cgi?id=220334
     5
     6        Reviewed by Eric Carlson.
     7
     8        * gpu-process/TestExpectations:
     9
    1102021-01-05  Chris Fleizach  <cfleizach@apple.com>
    211
  • trunk/LayoutTests/gpu-process/TestExpectations

    r271076 r271178  
    459459imported/w3c/web-platform-tests/media-source/mediasource-buffered.html [ Failure ]
    460460imported/w3c/web-platform-tests/media-source/mediasource-changetype.html [ Failure ]
    461 imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html [ Failure ]
    462461imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html [ Failure ]
    463462imported/w3c/web-platform-tests/media-source/mediasource-remove.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r271170 r271178  
     12021-01-05  Peng Liu  <peng.liu6@apple.com>
     2
     3        [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
     4        https://bugs.webkit.org/show_bug.cgi?id=220334
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add a completion handler parameter to SourceBufferPrivate::removeCodedFrames(),
     9        and the caller (SourceBuffer) will fire `update` and `updateend` events when
     10        the completion handler is called.
     11
     12        No new tests. Fix failures of the following tests:
     13        - imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html
     14        - imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
     15        - imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html
     16
     17        * Modules/mediasource/SourceBuffer.cpp:
     18        (WebCore::SourceBuffer::removeTimerFired):
     19        * platform/graphics/SourceBufferPrivate.cpp:
     20        (WebCore::SourceBufferPrivate::removeCodedFrames):
     21        * platform/graphics/SourceBufferPrivate.h:
     22        (WebCore::SourceBufferPrivate::removeCodedFrames):
     23
    1242021-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
    225
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r271078 r271178  
    614614    // 6. Run the coded frame removal algorithm with start and end as the start and end of the removal range.
    615615
    616     m_private->removeCodedFrames(m_pendingRemoveStart, m_pendingRemoveEnd, m_source->currentTime(), m_source->isEnded());
    617 
    618     // 7. Set the updating attribute to false.
    619     m_updating = false;
    620     m_pendingRemoveStart = MediaTime::invalidTime();
    621     m_pendingRemoveEnd = MediaTime::invalidTime();
    622 
    623     // 8. Queue a task to fire a simple event named update at this SourceBuffer object.
    624     scheduleEvent(eventNames().updateEvent);
    625 
    626     // 9. Queue a task to fire a simple event named updateend at this SourceBuffer object.
    627     scheduleEvent(eventNames().updateendEvent);
     616    m_private->removeCodedFrames(m_pendingRemoveStart, m_pendingRemoveEnd, m_source->currentTime(), m_source->isEnded(), [this, protectedThis = makeRef(*this)] {
     617        // 7. Set the updating attribute to false.
     618        m_updating = false;
     619        m_pendingRemoveStart = MediaTime::invalidTime();
     620        m_pendingRemoveEnd = MediaTime::invalidTime();
     621
     622        // 8. Queue a task to fire a simple event named update at this SourceBuffer object.
     623        scheduleEvent(eventNames().updateEvent);
     624
     625        // 9. Queue a task to fire a simple event named updateend at this SourceBuffer object.
     626        scheduleEvent(eventNames().updateendEvent);
     627    });
    628628}
    629629
  • trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp

    r271078 r271178  
    524524}
    525525
    526 void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded)
     526void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void()>&& completionHandler)
    527527{
    528528    ASSERT(start < end);
    529     if (start >= end)
    530         return;
     529    if (start >= end) {
     530        completionHandler();
     531        return;
     532    }
    531533
    532534    // 3.5.9 Coded Frame Removal Algorithm
     
    621623
    622624    LOG(Media, "SourceBuffer::removeCodedFrames(%p) - buffered = %s", this, toString(m_buffered->ranges()).utf8().data());
     625
     626    completionHandler();
    623627}
    624628
  • trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h

    r271078 r271178  
    8787    virtual void setShouldGenerateTimestamps(bool flag) { m_shouldGenerateTimestamps = flag; }
    8888    WEBCORE_EXPORT virtual void updateBufferedFromTrackBuffers(bool sourceIsEnded);
    89     virtual void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded);
     89    virtual void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded, CompletionHandler<void()>&& = [] { });
    9090    WEBCORE_EXPORT virtual void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
    9191    virtual void resetTimestampOffsetInTrackBuffers();
  • trunk/Source/WebKit/ChangeLog

    r271174 r271178  
     12021-01-05  Peng Liu  <peng.liu6@apple.com>
     2
     3        [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
     4        https://bugs.webkit.org/show_bug.cgi?id=220334
     5
     6        Reviewed by Eric Carlson.
     7
     8        Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement
     9        SourceBufferPrivateRemote::removeCodedFrames().
     10
     11        * GPUProcess/media/RemoteSourceBufferProxy.cpp:
     12        (WebKit::RemoteSourceBufferProxy::removeCodedFrames):
     13        * GPUProcess/media/RemoteSourceBufferProxy.h:
     14        * GPUProcess/media/RemoteSourceBufferProxy.messages.in:
     15        * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
     16        (WebKit::SourceBufferPrivateRemote::removeCodedFrames):
     17        * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
     18
    1192021-01-05  Ryan Haddad  <ryanhaddad@apple.com>
    220
  • trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp

    r271078 r271178  
    211211}
    212212
    213 void RemoteSourceBufferProxy::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded)
    214 {
    215     m_sourceBufferPrivate->removeCodedFrames(start, end, currentTime, isEnded);
     213void RemoteSourceBufferProxy::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void()>&& completionHandler)
     214{
     215    m_sourceBufferPrivate->removeCodedFrames(start, end, currentTime, isEnded, WTFMove(completionHandler));
    216216}
    217217
  • trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h

    r271078 r271178  
    9494    void startChangingType();
    9595    void updateBufferedFromTrackBuffers(bool sourceIsEnded);
    96     void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded);
     96    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void()>&&);
    9797    void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
    9898    void addTrackBuffer(TrackPrivateRemoteIdentifier);
  • trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in

    r271078 r271178  
    4141    ClearTrackBuffers()
    4242    SetAllTrackBuffersNeedRandomAccess()
    43     RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded)
     43    RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded) -> () Async
    4444    EvictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded)
    4545    ReenqueueMediaIfNeeded(MediaTime currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
  • trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp

    r271078 r271178  
    143143}
    144144
    145 void SourceBufferPrivateRemote::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded)
    146 {
    147     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::RemoveCodedFrames(start, end, currentMediaTime, isEnded), m_remoteSourceBufferIdentifier);
     145void SourceBufferPrivateRemote::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded, CompletionHandler<void()>&& completionHandler)
     146{
     147    m_gpuProcessConnection.connection().sendWithAsyncReply(Messages::RemoteSourceBufferProxy::RemoveCodedFrames(start, end, currentMediaTime, isEnded), WTFMove(completionHandler), m_remoteSourceBufferIdentifier);
    148148}
    149149
  • trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h

    r271078 r271178  
    9292    void setShouldGenerateTimestamps(bool) final;
    9393    void updateBufferedFromTrackBuffers(bool sourceIsEnded) final;
    94     void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded) final;
     94    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded, CompletionHandler<void()>&&) final;
    9595    void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded) final;
    9696    void resetTimestampOffsetInTrackBuffers() final;
Note: See TracChangeset for help on using the changeset viewer.