[webkit-changes] [WebKit/WebKit] ec49bb: [MSE] Decoding errors when appending segment with ...

Carlos Bentzen noreply at github.com
Mon Apr 15 23:38:19 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec49bb21041cfed7ffb5227ecf637c9e3ea2e594
      https://github.com/WebKit/WebKit/commit/ec49bb21041cfed7ffb5227ecf637c9e3ea2e594
  Author: Carlos Bentzen <cadubentzen at igalia.com>
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
    A LayoutTests/media/media-source/media-source-samples-out-of-order-erase-sync-frames-expected.txt
    A LayoutTests/media/media-source/media-source-samples-out-of-order-erase-sync-frames.html
    M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp

  Log Message:
  -----------
  [MSE] Decoding errors when appending segment with B-frames and previous segment ends with an I-frame
https://bugs.webkit.org/show_bug.cgi?id=272521

Reviewed by Xabier Rodriguez-Calvar.

When a segment containing B-frames is appended, WebKit has logic to erase frames from the previous segment
and avoid decoding glitches (219507 at main). However, the current logic falls short in one edge case: if
the previous segment ends with an I-frame in the overlap region to be erased.

If the demuxer honors ISOBMFF edit lists, then the first I-frame from an incoming segment with B-frames
can be placed earlier in decoding order than the last (I-)frame from the previous segment
(potentially with different resolution), and that last I-frame doesn't get erased, and will be pushed for
decoding. This confuses the decoder and the following P/B frames will fail to decode or decode incorrectly
with artifacts due to missing/incorrect reference frame.

This patch fixes this edge case by allowing I-frames to be erased from the track buffer only if they
are presented earlier than the incoming I-frame. We remove frames from the track buffer until we find an
I-frame that is presented later than the incoming I-frame. This handles the case when we get multiple I-frames
in the overlapping area, as exercised in the layout test.

Credit to Vivek Arumugam <vivek_arumugam at comcast.com> for initially finding the bug and investigating this.
This patch builds on top of a patch he proposed.

* LayoutTests/media/media-source/media-source-samples-out-of-order-erase-sync-frames-expected.txt: Added.
* LayoutTests/media/media-source/media-source-samples-out-of-order-erase-sync-frames.html: Added.
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::processMediaSample):

Canonical link: https://commits.webkit.org/277532@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list